Sync: code local unifié
Synchronisation du code source local (fait foi). Signed-off-by: lions dev Team
This commit is contained in:
@@ -6,20 +6,19 @@ import java.time.LocalDateTime;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* Entité InscriptionEvenement représentant l'inscription d'un membre à un événement
|
||||
* Entité InscriptionEvenement représentant l'inscription d'un membre à un
|
||||
* événement
|
||||
*
|
||||
* @author UnionFlow Team
|
||||
* @version 2.0
|
||||
* @since 2025-01-16
|
||||
*/
|
||||
@Entity
|
||||
@Table(
|
||||
name = "inscriptions_evenement",
|
||||
indexes = {
|
||||
@Index(name = "idx_inscription_membre", columnList = "membre_id"),
|
||||
@Index(name = "idx_inscription_evenement", columnList = "evenement_id"),
|
||||
@Index(name = "idx_inscription_date", columnList = "date_inscription")
|
||||
})
|
||||
@Table(name = "inscriptions_evenement", indexes = {
|
||||
@Index(name = "idx_inscription_membre", columnList = "membre_id"),
|
||||
@Index(name = "idx_inscription_evenement", columnList = "evenement_id"),
|
||||
@Index(name = "idx_inscription_date", columnList = "date_inscription")
|
||||
})
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@@ -41,30 +40,19 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
@Column(name = "date_inscription", nullable = false)
|
||||
private LocalDateTime dateInscription = LocalDateTime.now();
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "statut", length = 20)
|
||||
@Builder.Default
|
||||
private StatutInscription statut = StatutInscription.CONFIRMEE;
|
||||
private String statut = StatutInscription.CONFIRMEE.name();
|
||||
|
||||
@Column(name = "commentaire", length = 500)
|
||||
private String commentaire;
|
||||
|
||||
/** Énumération des statuts d'inscription */
|
||||
/** Énumération des statuts d'inscription (pour constantes) */
|
||||
public enum StatutInscription {
|
||||
CONFIRMEE("Confirmée"),
|
||||
EN_ATTENTE("En attente"),
|
||||
ANNULEE("Annulée"),
|
||||
REFUSEE("Refusée");
|
||||
|
||||
private final String libelle;
|
||||
|
||||
StatutInscription(String libelle) {
|
||||
this.libelle = libelle;
|
||||
}
|
||||
|
||||
public String getLibelle() {
|
||||
return libelle;
|
||||
}
|
||||
CONFIRMEE,
|
||||
EN_ATTENTE,
|
||||
ANNULEE,
|
||||
REFUSEE;
|
||||
}
|
||||
|
||||
// Méthodes utilitaires
|
||||
@@ -75,7 +63,7 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
* @return true si l'inscription est confirmée
|
||||
*/
|
||||
public boolean isConfirmee() {
|
||||
return StatutInscription.CONFIRMEE.equals(this.statut);
|
||||
return StatutInscription.CONFIRMEE.name().equals(this.statut);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +72,7 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
* @return true si l'inscription est en attente
|
||||
*/
|
||||
public boolean isEnAttente() {
|
||||
return StatutInscription.EN_ATTENTE.equals(this.statut);
|
||||
return StatutInscription.EN_ATTENTE.name().equals(this.statut);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,13 +81,13 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
* @return true si l'inscription est annulée
|
||||
*/
|
||||
public boolean isAnnulee() {
|
||||
return StatutInscription.ANNULEE.equals(this.statut);
|
||||
return StatutInscription.ANNULEE.name().equals(this.statut);
|
||||
}
|
||||
|
||||
/** Confirme l'inscription */
|
||||
public void confirmer() {
|
||||
this.statut = StatutInscription.CONFIRMEE;
|
||||
this.dateModification = LocalDateTime.now();
|
||||
this.statut = StatutInscription.CONFIRMEE.name();
|
||||
setDateModification(LocalDateTime.now());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,9 +96,9 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
* @param commentaire le commentaire d'annulation
|
||||
*/
|
||||
public void annuler(String commentaire) {
|
||||
this.statut = StatutInscription.ANNULEE;
|
||||
this.statut = StatutInscription.ANNULEE.name();
|
||||
this.commentaire = commentaire;
|
||||
this.dateModification = LocalDateTime.now();
|
||||
setDateModification(LocalDateTime.now());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,28 +107,27 @@ public class InscriptionEvenement extends BaseEntity {
|
||||
* @param commentaire le commentaire de mise en attente
|
||||
*/
|
||||
public void mettreEnAttente(String commentaire) {
|
||||
this.statut = StatutInscription.EN_ATTENTE;
|
||||
this.statut = StatutInscription.EN_ATTENTE.name();
|
||||
this.commentaire = commentaire;
|
||||
this.dateModification = LocalDateTime.now();
|
||||
setDateModification(LocalDateTime.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuse l'inscription
|
||||
* Refuser l'inscription
|
||||
*
|
||||
* @param commentaire le commentaire de refus
|
||||
*/
|
||||
public void refuser(String commentaire) {
|
||||
this.statut = StatutInscription.REFUSEE;
|
||||
this.statut = StatutInscription.REFUSEE.name();
|
||||
this.commentaire = commentaire;
|
||||
this.dateModification = LocalDateTime.now();
|
||||
setDateModification(LocalDateTime.now());
|
||||
}
|
||||
|
||||
// Callbacks JPA
|
||||
|
||||
@PreUpdate
|
||||
public void preUpdate() {
|
||||
super.onUpdate(); // Appelle le onUpdate de BaseEntity
|
||||
this.dateModification = LocalDateTime.now();
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user