Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kagaramag committed Aug 8, 2019
1 parent 8ada3a1 commit fe330a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 1 addition & 5 deletions src/controllers/CommentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ export default class CommentController {
const userId = req.user.id;
const { articleSlug, commentId } = req.params;
const newComment = { articleSlug, commentId, userId };
const findComment = await comment.getSingle({ articleSlug, id: commentId, userId });
const findAllEdit = await editcomment.getAll(newComment);
if (findAllEdit.length === 0) {
return res.status(status.OK).json({ message: 'All previous', Comments: findComment });
}
return res.status(status.OK).json({ message: 'All previous comments', Comments: findAllEdit });
return res.status(status.OK).json({ message: 'All previous comments', history: findAllEdit });
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/queries/articles/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async (condition = {}) => db.Article.findOne({
{
model: db.User,
as: 'author',
attributes: ['username', 'bio', 'image']
attributes: ['username', 'firstName', 'lastName', 'bio', 'image']
}
]
});
10 changes: 5 additions & 5 deletions src/routes/api/articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ articles.get(
'/articles/:slug',
checkArticleBySlug,
(req, res, next) => (req.article.status !== 'published'
&& res.status(404).json({
errors: {
article: 'article not found'
}
}))
&& res.status(404).json({
errors: {
article: 'article not found'
}
}))
|| next(),
asyncHandler(ArticleController.getSpecificArticle)
);
Expand Down

0 comments on commit fe330a0

Please sign in to comment.