Open
Conversation
…umentation for 'forbidden' was added, a method that was not going to be used was removed and an import was removed
…to authentication-favorites
…to authentication-favorites
…piForbiddenResponse'
…piForbiddenResponse'
…ion for 'ApiUnaunthorizeResponse' and 'ApiBadRequestResponse'
ghnoob
requested changes
Jan 28, 2022
Contributor
ghnoob
left a comment
There was a problem hiding this comment.
Revisar las conversaciones que no estan resueltas
ghnoob
requested changes
Jan 30, 2022
Contributor
ghnoob
left a comment
There was a problem hiding this comment.
Tambien quedaron dos conversaciones sin resolver
Comment on lines
+33
to
45
| async create(body: CreateFavoriteDto, user: User): Promise<void> { | ||
| const itemExist = await this.itemRepo.findOne(body.itemId); | ||
|
|
||
| if (!itemExist) { | ||
| throw new UnprocessableEntityException('Item does not exist'); | ||
| } | ||
|
|
||
| const preFavorite: any = { ...body, user: user }; | ||
|
|
||
| const newFavorite = this.favoritesRepo.create(preFavorite); | ||
|
|
||
| await this.favoritesRepo.save(newFavorite); | ||
| return; | ||
| } |
Contributor
There was a problem hiding this comment.
- falta asignarle el item al favorito
- hay que comprobar que no se pueda agregar el mismo favorito dos veces
- cuando el item no existe esta tirando la excepcion bien pero no lo esta manejando nest por lo que devuelve 201 igual
| name: 'id', | ||
| type: Number, | ||
| required: true, | ||
| description: 'The ID of the Favorite record to delete.', |
Comment on lines
+270
to
+272
| if (ability.cannot(Permission.Read, subject('Favorite', favorite))) { | ||
| throw new ForbiddenException(); | ||
| } |
Contributor
There was a problem hiding this comment.
esta rebotando todas las peticiones, incluso cuando no tendria que hacerlo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Autenticacion en el modulo favorites
Para completar la tarea se agrego lo siguiente: