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
4e4d73a7
authored
Mar 04, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: [Usuario]: Correcciones al comprobar con PostMan
parent
cd4796b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
13 deletions
src/main/java/com/ujaen/tfg/mangaffinity/entidades/BibliotecaPersonal.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/BibliotecaPersonal.java
View file @
4e4d73a7
...
...
@@ -17,7 +17,7 @@ public class BibliotecaPersonal {
private
Long
id
;
@OneToOne
@JoinColumn
(
name
=
"usuario_id"
,
nullable
=
false
,
unique
=
true
)
@JoinColumn
(
name
=
"usuario_id"
,
referencedColumnName
=
"id"
)
private
Usuario
usuario
;
@OneToMany
(
mappedBy
=
"bibliotecaPersonal"
)
...
...
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
View file @
4e4d73a7
...
...
@@ -37,8 +37,7 @@ public class Usuario {
private
String
rol
;
@OneToOne
(
cascade
=
CascadeType
.
ALL
)
@JoinColumn
(
name
=
"usuario_id"
,
referencedColumnName
=
"id"
)
@OneToOne
(
mappedBy
=
"usuario"
,
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
LAZY
)
private
BibliotecaPersonal
bibliotecaPersonal
;
...
...
src/main/java/com/ujaen/tfg/mangaffinity/rest/RecursosController.java
View file @
4e4d73a7
...
...
@@ -18,8 +18,6 @@ import java.time.LocalDate;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
@RestController
@RequestMapping
(
"/recursos"
)
...
...
@@ -29,8 +27,6 @@ public class RecursosController {
private
ServicioRecursos
servicioRecursos
;
@Autowired
private
Mapper
mapper
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RecursosController
.
class
);
@PostMapping
(
"/"
)
public
ResponseEntity
<
String
>
crearRecurso
(
@RequestBody
DTORecurso
recurso
)
{
...
...
@@ -45,26 +41,20 @@ public class RecursosController {
@GetMapping
(
"/titulo/{titulo}"
)
public
ResponseEntity
<
List
<
DTORecurso
>>
buscarPorTitulo
(
@PathVariable
String
titulo
)
{
log
.
info
(
"🔍 Buscando recurso con título: "
+
titulo
);
try
{
List
<
Recurso
>
recursos
=
servicioRecursos
.
buscarRecursoPorTitulo
(
titulo
);
log
.
info
(
"📋 Recursos encontrados: "
+
recursos
.
size
());
if
(
recursos
.
isEmpty
())
{
return
ResponseEntity
.
status
(
HttpStatus
.
NOT_FOUND
).
body
(
Collections
.
emptyList
());
}
List
<
DTORecurso
>
dtoRecursos
=
recursos
.
stream
().
map
(
mapper:
:
dto
).
toList
();
return
ResponseEntity
.
ok
(
dtoRecursos
);
}
catch
(
Exception
e
)
{
log
.
error
(
"❌ Error al buscar recurso: "
,
e
);
return
ResponseEntity
.
status
(
HttpStatus
.
INTERNAL_SERVER_ERROR
).
build
();
}
}
@GetMapping
(
"/genero/{genero}"
)
public
ResponseEntity
<
List
<
DTORecurso
>>
buscarPorGenero
(
@PathVariable
Genero
genero
)
{
try
{
...
...
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