Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alba María Álvarez
/
AppRecetas
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
545c9e59
authored
Aug 31, 2025
by
Alba María Álvarez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bugfix(recipe/controller): usado id del usuario en lugar de email para autorización
parent
8d4b97d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
5 deletions
src/main/java/com/example/apprecetas/recipe/infrastructure/controller/DeleteRecipeController.java
src/main/java/com/example/apprecetas/recipe/infrastructure/controller/DeleteRecipeController.java
View file @
545c9e59
...
...
@@ -23,16 +23,13 @@ public class DeleteRecipeController {
private
final
ReadRecipeUseCase
readRecipeUseCase
;
private
final
ReadUserUseCase
readUserUseCase
;
@DeleteMapping
(
"/{id}"
)
public
ResponseEntity
<
String
>
delete
(
@PathVariable
String
id
)
{
Recipe
recipe
=
readRecipeUseCase
.
readById
(
id
);
String
email
=
SecurityContextHolder
.
getContext
().
getAuthentication
().
getName
();
User
user
=
readUserUseCase
.
readByEmail
(
email
);
String
userId
=
SecurityContextHolder
.
getContext
().
getAuthentication
().
getName
();
if
(!
recipe
.
getUserId
().
equals
(
user
.
getId
()
))
if
(!
recipe
.
getUserId
().
equals
(
user
Id
))
return
ResponseEntity
.
status
(
HttpStatus
.
UNAUTHORIZED
).
build
();
service
.
delete
(
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment