Skip to content

Commit

Permalink
rebase from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Anguandia committed Nov 7, 2019
1 parent a318187 commit 4dfa2a7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/controllers/articles.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ class Articles {
lastname,
image
};
const rating = await RateService.getArticleRatingStatistic(article.slug);
const rating = await RateService.getArticleRatingStatistic(
article.slug
);
let claps = await likeService.getAllAClaps(article.slug);
claps = Object.values(claps)[0];
const readTime = Helper.calculateReadTime(article.body);
Expand Down Expand Up @@ -333,7 +335,10 @@ class Articles {
return util.send(res);
}
if (req.auth.id !== findArticle.authorId) {
util.setError(403, 'Sorry you can not DELETE an article that does not belong to you.');
util.setError(
403,
'Sorry you can not DELETE an article that does not belong to you.'
);
return util.send(res);
}
await db.destroy({
Expand Down Expand Up @@ -361,10 +366,15 @@ class Articles {
return util.send(res);
}
if (req.auth.id !== findArticle.authorId) {
util.setError(401, 'Sorry you can not UPDATE an article that does not belong to you.');
util.setError(
401,
'Sorry you can not UPDATE an article that does not belong to you.'
);
return util.send(res);
}
const { title, body, description, images, } = req.body;
const {
title, body, description, images
} = req.body;
const updatedArticle = await articleService.updateArticle(req.params.slug, {
title,
body,
Expand Down

0 comments on commit 4dfa2a7

Please sign in to comment.