-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OT 83 UPDATE COMMENT #128
OT 83 UPDATE COMMENT #128
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
||
const resultUpdate = await CommentDao.updateComment({ id }, { body }); | ||
|
||
return res.status(200).json({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Este return lo haría fuera del try
@@ -84,6 +84,67 @@ class RoleMiddleware { | |||
|
|||
return next(); | |||
} | |||
static async isOwnerOfComment(req, res, next) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: isCommentOwner en vez de isOwnerOfComment
} | ||
|
||
try { | ||
comment = await Comment.findOne({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta lógica la podría tener el DAO o el controlador de comentarios, para centralizar lógica y mantener encapsulación.
isOwnerOfComment middleware added
update comment router and controller added