Commit 35ace176 by Rubén Ramírez

feat: [Usuario]:Nuevos atributos para almacenar los seguidores y seguidos

parent d37843f8
......@@ -5,6 +5,9 @@ import lombok.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import java.util.HashSet;
import java.util.Set;
@Entity
@Table(name = "usuarios")
@Getter
......@@ -46,6 +49,12 @@ public class Usuario {
@OneToOne(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private BibliotecaPersonal bibliotecaPersonal;
@OneToMany(mappedBy = "seguidor", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<Seguimiento> seguidos = new HashSet<>();
@OneToMany(mappedBy = "seguido", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<Seguimiento> seguidores = new HashSet<>();
public Usuario(String email, String nombreUsuario, String contrasenia) {
this.email = email;
this.nombreUsuario = nombreUsuario;
......@@ -53,5 +62,8 @@ public class Usuario {
this.rol = "USUARIO_REGISTRADO";
this.bibliotecaPersonal = new BibliotecaPersonal(this); this.descripcion = "";
this.fotoPerfil = null;
this.seguidos = new HashSet<>();
this.seguidores = new HashSet<>();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment