Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rubén Ramírez
/
MangAffinity
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
8da4b779
authored
Feb 23, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: [RecursosControlador]: Añadido la función para obtener capítulos en el controlador
parent
3da3ccae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
src/main/java/com/ujaen/tfg/mangaffinity/seguridad/ServicioSeguridad.java
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
View file @
8da4b779
...
...
@@ -165,5 +165,17 @@ public class RecursosController {
}
}
@GetMapping
(
"/{id}/capitulos"
)
public
ResponseEntity
<
List
<
DTOCapitulo
>>
obtenerCapitulosDeRecurso
(
@PathVariable
Long
id
)
{
try
{
List
<
Capitulo
>
capitulos
=
servicioRecursos
.
obtenerCapitulosDeRecurso
(
id
);
if
(
capitulos
.
isEmpty
())
{
return
ResponseEntity
.
status
(
HttpStatus
.
NOT_FOUND
).
build
();
}
List
<
DTOCapitulo
>
dtoCapitulos
=
capitulos
.
stream
().
map
(
mapper:
:
dto
).
toList
();
return
ResponseEntity
.
ok
(
dtoCapitulos
);
}
catch
(
Exception
e
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
build
();
}
}
}
\ No newline at end of file
src/main/java/com/ujaen/tfg/mangaffinity/seguridad/ServicioSeguridad.java
View file @
8da4b779
...
...
@@ -39,6 +39,7 @@ public class ServicioSeguridad {
.
requestMatchers
(
HttpMethod
.
PUT
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
DELETE
,
"/recursos/{id}"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
POST
,
"/recursos/{id}/capitulos"
).
hasAuthority
(
"ROLE_ADMIN"
)
.
requestMatchers
(
HttpMethod
.
GET
,
"/recursos/{id}/capitulos"
).
permitAll
()
.
anyRequest
().
authenticated
()
)
...
...
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