diff --git a/app/controllers/tags.py b/app/controllers/tags.py index 3fd3969a..0884c492 100644 --- a/app/controllers/tags.py +++ b/app/controllers/tags.py @@ -95,7 +95,7 @@ def delete(self, tag_id): class TagFollowingView(Resource): - @ jwt_required + @jwt_required def post(self, tag_id): current_user_id = get_jwt_identity() tag = Tag.get_by_id(tag_id) @@ -103,7 +103,6 @@ def post(self, tag_id): if not tag: return dict(status='fail', message=f'Tag with id {tag_id} not found'), 404 - existing_tag_follow = TagFollowers.find_first( user_id=current_user_id, tag_id=tag_id) if existing_tag_follow: @@ -122,7 +121,7 @@ def post(self, tag_id): message=f'You are now following tag with id {tag_id}' ), 201 - @ jwt_required + @jwt_required def get(self, tag_id): tag = Tag.get_by_id(tag_id) follower_schema = UserIndexSchema(many=True) @@ -138,7 +137,7 @@ def get(self, tag_id): data=dict(followers=json.loads(users_data)) ), 200 - @ jwt_required + @jwt_required def delete(self, tag_id): current_user_id = get_jwt_identity() tag = Tag.get_by_id(tag_id) diff --git a/app/models/tags.py b/app/models/tags.py index 6a8a5abc..2981904a 100644 --- a/app/models/tags.py +++ b/app/models/tags.py @@ -16,12 +16,14 @@ class Tag(ModelMixin): projects = db.relationship("ProjectTag", back_populates="tag") date_created = db.Column(db.DateTime, default=db.func.current_timestamp()) followers = db.relationship('TagFollowers', back_populates='tag') + documentation_url = db.Column(db.String, nullable=True) + official_url = db.Column(db.String, nullable=True) + github_link = db.Column(db.String, nullable=True) def __repr__(self): return f"" - class ProjectTag(ModelMixin): __tablename__ = "project_tag" diff --git a/app/schemas/tags.py b/app/schemas/tags.py index e88e245f..5c493b27 100644 --- a/app/schemas/tags.py +++ b/app/schemas/tags.py @@ -20,6 +20,9 @@ class TagSchema(Schema): date_created = fields.Date(dump_only=True) projects_count = fields.Method("get_projects_count", dump_only=True) is_following = fields.Method("get_is_following", dump_only=True) + documentation_url = fields.String(allow_none=True) + official_url = fields.String(allow_none=True) + github_link = fields.String(allow_none=True) def get_projects_count(self, obj): return len(obj.projects)