58 lines
1.5 KiB
Java
58 lines
1.5 KiB
Java
package local.epul4a.fotosharing.model;
|
|
|
|
import jakarta.persistence.*;
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
@Entity
|
|
@Getter
|
|
@Setter
|
|
public class Photo {
|
|
public enum Visibilite { PRIVATE, PUBLIC, SHARED }
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
private String nomFichierOriginal;
|
|
private String uuidFichier;
|
|
private LocalDateTime dateUpload;
|
|
|
|
// Type MIME détecté (pour header HTTP Content-Type)
|
|
@Column(length = 100)
|
|
private String mimeType;
|
|
|
|
// Taille du fichier en bytes
|
|
private Long tailleFichier;
|
|
|
|
// Métadonnées du fichier
|
|
@Column
|
|
private Integer largeur; // Largeur de l'image en pixels
|
|
|
|
@Column
|
|
private Integer hauteur; // Hauteur de l'image en pixels
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
private Visibilite visibilite;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "id_utilisateur")
|
|
private Utilisateur proprietaire;
|
|
|
|
@ManyToMany(mappedBy = "photos")
|
|
private Set<Album> albums = new HashSet<>();
|
|
|
|
@OneToMany(mappedBy = "photo", cascade = CascadeType.ALL, orphanRemoval = true)
|
|
private Set<Partage> partages = new HashSet<>();
|
|
|
|
@OneToMany(mappedBy = "photo", cascade = CascadeType.ALL, orphanRemoval = true)
|
|
private Set<Commentaire> commentaires = new HashSet<>();
|
|
|
|
@Column
|
|
private String uuidThumbnail;
|
|
}
|