-
Notifications
You must be signed in to change notification settings - Fork 3
Fixfavourites #13
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
base: main
Are you sure you want to change the base?
Fixfavourites #13
Conversation
| this.router.get(`${this.path}/:userId`, authMiddleware, permissionMiddleware, this.getFavourites); | ||
| this.router.put(`${this.path}/:userId`, authMiddleware, permissionMiddleware, this.addOrRemoveRestaurantToFavourites); | ||
| this.router.get(`${this.path}/:userId`, authMiddleware, this.getFavourites); | ||
| this.router.put(`${this.path}/:userId`, authMiddleware, favourtieEditMiddleware, this.addOrRemoveRestaurantToFavourites); |
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.
What's behind permissionMiddleware removal?
| import commentDeleteMiddleware from '../middleware/commentDelete.middleware'; | ||
| import commentEditMiddleware from '../middleware/editComment.middleware'; | ||
|
|
||
| class CommentsController implements Controller { |
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.
There is a lot of code that we have to test.
| try { | ||
| selectedComment = await comment.findById(commentId); | ||
| const commentOwner = selectedComment.user !== null && selectedComment.user; | ||
| if ( userRole === 2) { |
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.
| if ( userRole === 2) { | |
| if ( userRole === userRoles.User) { |
We have to make a map that will hold these numeric values
| try { | ||
| const favourieListtId = request.params.userId; | ||
| const userId = request.user._id; | ||
| if ( userId.toString() !== favourieListtId.toString() ) { |
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.
favourieListtId -misspeled
userId.toString() !== favourieListtId.toString() - this can be extracted to const
Add middleware