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
868e37b3
authored
Feb 13, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: [Genero-Recurso]: Hecha la relación entre Género y Recurso y modificado el ER
parent
e41e31d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
36 deletions
src/files/ER.puml
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Genero.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Recurso.java
src/files/ER.puml
View file @
868e37b3
...
...
@@ -23,6 +23,11 @@ entity "Recurso" as Recurso {
autor : String
}
entity "Genero" as Genero {
*recurso_id : Integer
genero : String
}
entity "Categoria" as Categoria {
*id : Integer
nombre : String
...
...
@@ -34,17 +39,6 @@ entity "Repositorio_Recurso" as RepositorioRecurso {
categoria_id : Integer
}
entity "Genero" as Genero {
*id : Integer
--
nombre : String
}
entity "Recurso_Genero" as RecursoGenero {
*recurso_id : Integer
*genero_id : Integer
}
entity "Capitulo" as Capitulo {
*id : Integer
--
...
...
@@ -60,9 +54,9 @@ Usuario ||--o{ Repositorio : "tiene"
Repositorio ||--o{ RepositorioRecurso : "contiene"
Recurso ||--o{ RepositorioRecurso : "almacenado en"
RepositorioRecurso }|--|| Categoria : "clasificado en"
Recurso ||--o{ RecursoGenero : "clasificado como"
Genero ||--o{ RecursoGenero : "pertenece a"
Recurso ||--o{ Capitulo : "contiene"
' Corrección: Un recurso puede tener varios géneros
Recurso ||--o{ Genero : "tiene varios"
@enduml
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Genero.java
View file @
868e37b3
package
com
.
ujaen
.
tfg
.
mangaffinity
.
entidades
;
import
jakarta.persistence.*
;
import
lombok.*
;
import
jakarta.validation.constraints.NotBlank
;
@Entity
@Table
(
name
=
"generos"
)
@Getter
@NoArgsConstructor
public
class
Genero
{
@Id
@NotBlank
@Column
(
nullable
=
false
,
unique
=
true
)
private
String
nombre
;
public
Genero
(
String
nombre
)
{
this
.
nombre
=
nombre
;
}
}
\ No newline at end of file
public
enum
Genero
{
ACCION
,
AVENTURA
,
COMEDIA
,
DRAMA
,
FANTASIA
,
HORROR
,
CIENCIA_FICCION
,
ROMANCE
,
DEPORTES
}
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Recurso.java
View file @
868e37b3
...
...
@@ -5,7 +5,8 @@ import lombok.*;
import
jakarta.validation.constraints.NotBlank
;
import
jakarta.validation.constraints.NotNull
;
import
java.time.LocalDate
;
import
java.util.HashSet
;
import
java.util.Set
;
@Entity
...
...
@@ -35,6 +36,11 @@ public class Recurso {
@Column
(
nullable
=
false
)
private
String
autor
;
@ElementCollection
(
targetClass
=
Genero
.
class
)
@Enumerated
(
EnumType
.
STRING
)
@CollectionTable
(
name
=
"recurso_genero"
,
joinColumns
=
@JoinColumn
(
name
=
"recurso_id"
))
@Column
(
name
=
"genero"
)
private
Set
<
Genero
>
generos
=
new
HashSet
<>();
// Constructor con parámetros obligatorios
public
Recurso
(
String
titulo
,
String
descripcion
,
LocalDate
fechaPublicacion
,
String
autor
)
{
...
...
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