diff --git a/app/main/controller/article_controller.py b/app/main/controller/article_controller.py index 76f1462..4ae8d3e 100644 --- a/app/main/controller/article_controller.py +++ b/app/main/controller/article_controller.py @@ -15,14 +15,15 @@ api = PostDto.api -@api.route("/") +@api.route("/") class ArticleFetch(Resource): @api.marshal_with(PostDto.article) - @api.doc(params={'post_id': 'Post Id'}) - def get(self, post_id): + @api.expect(PostDto.articleReq) + def get(self): """ Fetches the article given by the id. """ + post_id = request.args.get('post_id') p = Post.getArticles(post_id) if p is not None: article = { diff --git a/app/main/util/dto.py b/app/main/util/dto.py index 612b0a7..80e7e31 100644 --- a/app/main/util/dto.py +++ b/app/main/util/dto.py @@ -50,6 +50,12 @@ class UserDto: class PostDto: api = Namespace('article', description='article related operations') + + articleReq = api.model('articleReq', { + 'post_id': fields.Integer(required=True, + description="Post id of the required post") + }) + article = api.model('article', { 'author': fields.String(required=True, description="Author of the post"),