Skip to content
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

Merged
merged 4 commits into from
Oct 12, 2022
Merged

OT 83 UPDATE COMMENT #128

merged 4 commits into from
Oct 12, 2022

Conversation

rich27a
Copy link
Collaborator

@rich27a rich27a commented Oct 10, 2022

isOwnerOfComment middleware added
update comment router and controller added

@rich27a rich27a requested a review from soyarielruiz October 10, 2022 19:45
Copy link
Collaborator

@soyarielruiz soyarielruiz left a 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({
Copy link
Collaborator

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) {
Copy link
Collaborator

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({
Copy link
Collaborator

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.

@soyarielruiz soyarielruiz merged commit 611a6f1 into development Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants