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
b5895602
authored
Feb 20, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: [Entity]: Correcciones mínimas en las entidades
parent
499e5e22
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
12 deletions
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Capitulo.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Recurso.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Repositorio.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/RepositorioRecurso.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Capitulo.java
View file @
b5895602
...
...
@@ -24,7 +24,7 @@ public class Capitulo {
private
String
titulo
;
@NotBlank
@Column
(
nullable
=
false
,
unique
=
true
)
@Column
(
nullable
=
false
)
private
String
url
;
@NotBlank
...
...
@@ -35,7 +35,7 @@ public class Capitulo {
@JoinColumn
(
name
=
"recurso_id"
,
nullable
=
false
)
private
Recurso
recurso
;
// Constructor con parámetros
public
Capitulo
(
int
numero
,
String
titulo
,
String
url
,
String
fuente
,
Recurso
recurso
)
{
this
.
numero
=
numero
;
this
.
titulo
=
titulo
;
...
...
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Recurso.java
View file @
b5895602
...
...
@@ -38,6 +38,7 @@ public class Recurso {
@Column
(
nullable
=
false
)
private
String
autor
;
//Clase que no es entidad, se almacenan como string
@ElementCollection
(
targetClass
=
Genero
.
class
)
@Enumerated
(
EnumType
.
STRING
)
@CollectionTable
(
name
=
"recurso_genero"
,
joinColumns
=
@JoinColumn
(
name
=
"recurso_id"
))
...
...
@@ -45,11 +46,10 @@ public class Recurso {
private
Set
<
Genero
>
generos
=
new
HashSet
<>();
// Relación con Cap
itulo (Un recurso tiene varios capítulos)
// Relación con Cap
ítulo; un recurso tiene varios capítulos
@OneToMany
(
mappedBy
=
"recurso"
)
private
List
<
Capitulo
>
capitulos
=
new
ArrayList
<>();
// Constructor con parámetros obligatorios
public
Recurso
(
String
titulo
,
String
descripcion
,
LocalDate
fechaPublicacion
,
String
autor
)
{
this
.
titulo
=
titulo
;
this
.
descripcion
=
descripcion
;
...
...
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Repositorio.java
View file @
b5895602
...
...
@@ -8,7 +8,7 @@ import java.util.Set;
@Entity
@Table
(
name
=
"repositorios"
)
@Getter
@NoArgsConstructor
(
access
=
AccessLevel
.
PROTECTED
)
@NoArgsConstructor
public
class
Repositorio
{
@Id
...
...
@@ -19,7 +19,7 @@ public class Repositorio {
@JoinColumn
(
name
=
"usuario_id"
,
nullable
=
false
,
unique
=
true
)
private
Usuario
usuario
;
@OneToMany
(
mappedBy
=
"repositorio"
,
cascade
=
CascadeType
.
ALL
,
orphanRemoval
=
true
)
@OneToMany
(
mappedBy
=
"repositorio"
)
private
Set
<
RepositorioRecurso
>
recursos
=
new
HashSet
<>();
public
Repositorio
(
Usuario
usuario
)
{
...
...
src/main/java/com/ujaen/tfg/mangaffinity/entidades/RepositorioRecurso.java
View file @
b5895602
package
com
.
ujaen
.
tfg
.
mangaffinity
.
entidades
;
import
jakarta.persistence.*
;
import
lombok.*
;
@Entity
@Table
(
name
=
"repositorio_recurso"
)
@Getter
@NoArgsConstructor
(
access
=
AccessLevel
.
PROTECTED
)
@NoArgsConstructor
public
class
RepositorioRecurso
{
@Id
...
...
@@ -32,7 +31,4 @@ public class RepositorioRecurso {
this
.
categoria
=
categoria
;
}
public
void
cambiarCategoria
(
Categoria
nuevaCategoria
)
{
this
.
categoria
=
nuevaCategoria
;
}
}
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
View file @
b5895602
...
...
@@ -31,7 +31,7 @@ public class Usuario {
private
String
contrasenia
;
@OneToOne
(
mappedBy
=
"usuario"
,
cascade
=
CascadeType
.
ALL
,
orphanRemoval
=
true
)
@OneToOne
(
mappedBy
=
"usuario"
)
private
Repositorio
repositorio
;
public
Usuario
(
String
email
,
String
nombreUsuario
,
String
contrasenia
)
{
...
...
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