feat: Refonte du schéma Adhérent (Lieu de naissance, Nationalité, Type Licence), suppression du téléphone, email obligatoire

This commit is contained in:
2026-06-14 01:07:45 +02:00
parent 569927c644
commit 3ed9d0454b
14 changed files with 208 additions and 83 deletions
@@ -23,15 +23,18 @@ public class Adherent {
@org.springframework.format.annotation.DateTimeFormat(iso = org.springframework.format.annotation.DateTimeFormat.ISO.DATE)
private LocalDate dateNaissance;
@Column(length = 20)
private String telephone;
@Column(name = "lieu_naissance_ville", nullable = false, length = 100)
private String lieuNaissanceVille;
@Column(length = 100)
@Column(name = "lieu_naissance_pays", nullable = false, length = 100)
private String lieuNaissancePays;
@Column(nullable = false, length = 100)
private String nationalite;
@Column(nullable = false, length = 100)
private String email;
@Column(columnDefinition = "TEXT")
private String adresse;
@Column(name = "representant_legal", length = 150)
private String representantLegal;
@@ -63,15 +66,18 @@ public class Adherent {
public LocalDate getDateNaissance() { return dateNaissance; }
public void setDateNaissance(LocalDate dateNaissance) { this.dateNaissance = dateNaissance; }
public String getTelephone() { return telephone; }
public void setTelephone(String telephone) { this.telephone = telephone; }
public String getLieuNaissanceVille() { return lieuNaissanceVille; }
public void setLieuNaissanceVille(String lieuNaissanceVille) { this.lieuNaissanceVille = lieuNaissanceVille; }
public String getLieuNaissancePays() { return lieuNaissancePays; }
public void setLieuNaissancePays(String lieuNaissancePays) { this.lieuNaissancePays = lieuNaissancePays; }
public String getNationalite() { return nationalite; }
public void setNationalite(String nationalite) { this.nationalite = nationalite; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getAdresse() { return adresse; }
public void setAdresse(String adresse) { this.adresse = adresse; }
public String getRepresentantLegal() { return representantLegal; }
public void setRepresentantLegal(String representantLegal) { this.representantLegal = representantLegal; }
@@ -6,14 +6,16 @@ import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = "categorie")
@Table(name = "categorie", uniqueConstraints = {
@UniqueConstraint(columnNames = {"nom", "saison_id"})
})
public class Categorie {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true, length = 20)
@Column(nullable = false, length = 20)
private String nom;
@Column(name = "annee_min")
@@ -35,6 +35,12 @@ public class Licence {
@Column(name = "numero_licence", length = 50)
private String numeroLicence;
@Column(name = "type_demande", length = 50)
private String typeDemande;
@Column(name = "type_licence", length = 50)
private String typeLicence;
@OneToMany(mappedBy = "licence", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Paiement> paiements = new ArrayList<>();
@@ -113,14 +119,20 @@ public class Licence {
public String getEtat() { return etat; }
public void setEtat(String etat) { this.etat = etat; }
public String getNumeroLicence() { return numeroLicence; }
public void setNumeroLicence(String numeroLicence) { this.numeroLicence = numeroLicence; }
public String getTypeDemande() { return typeDemande; }
public void setTypeDemande(String typeDemande) { this.typeDemande = typeDemande; }
public String getTypeLicence() { return typeLicence; }
public void setTypeLicence(String typeLicence) { this.typeLicence = typeLicence; }
public List<Paiement> getPaiements() { return paiements; }
public void setPaiements(List<Paiement> paiements) { this.paiements = paiements; }
public List<Dotation> getDotations() { return dotations; }
public void setDotations(List<Dotation> dotations) { this.dotations = dotations; }
public String getNumeroLicence() { return numeroLicence; }
public void setNumeroLicence(String numeroLicence) { this.numeroLicence = numeroLicence; }
public void addPaiement(Paiement paiement) {
paiements.add(paiement);
@@ -21,15 +21,18 @@ public class PreInscription {
@Column(name = "date_naissance", nullable = false)
private LocalDate dateNaissance;
@Column(length = 20)
private String telephone;
@Column(name = "lieu_naissance_ville", nullable = false, length = 100)
private String lieuNaissanceVille;
@Column(length = 150)
@Column(name = "lieu_naissance_pays", nullable = false, length = 100)
private String lieuNaissancePays;
@Column(nullable = false, length = 100)
private String nationalite;
@Column(nullable = false, length = 150)
private String email;
@Column(columnDefinition = "TEXT")
private String adresse;
@Column(name = "representant_legal", length = 150)
private String representantLegal;
@@ -56,15 +59,18 @@ public class PreInscription {
public LocalDate getDateNaissance() { return dateNaissance; }
public void setDateNaissance(LocalDate dateNaissance) { this.dateNaissance = dateNaissance; }
public String getTelephone() { return telephone; }
public void setTelephone(String telephone) { this.telephone = telephone; }
public String getLieuNaissanceVille() { return lieuNaissanceVille; }
public void setLieuNaissanceVille(String lieuNaissanceVille) { this.lieuNaissanceVille = lieuNaissanceVille; }
public String getLieuNaissancePays() { return lieuNaissancePays; }
public void setLieuNaissancePays(String lieuNaissancePays) { this.lieuNaissancePays = lieuNaissancePays; }
public String getNationalite() { return nationalite; }
public void setNationalite(String nationalite) { this.nationalite = nationalite; }
public String getEmail() { return email; }
public void setEmail(String email) { this.email = email; }
public String getAdresse() { return adresse; }
public void setAdresse(String adresse) { this.adresse = adresse; }
public String getRepresentantLegal() { return representantLegal; }
public void setRepresentantLegal(String representantLegal) { this.representantLegal = representantLegal; }
@@ -38,9 +38,10 @@ public class PreInscriptionService {
adherent.setNom(pre.getNom().toUpperCase());
adherent.setPrenom(pre.getPrenom());
adherent.setDateNaissance(pre.getDateNaissance());
adherent.setTelephone(pre.getTelephone());
adherent.setLieuNaissanceVille(pre.getLieuNaissanceVille());
adherent.setLieuNaissancePays(pre.getLieuNaissancePays());
adherent.setNationalite(pre.getNationalite());
adherent.setEmail(pre.getEmail());
adherent.setAdresse(pre.getAdresse());
adherent.setRepresentantLegal(pre.getRepresentantLegal());
// Par défaut
adherent.setSexe("MASCULIN");
@@ -0,0 +1,5 @@
-- Drop the global unique constraint on 'nom'
ALTER TABLE categorie DROP CONSTRAINT IF EXISTS categorie_nom_key;
-- Add a composite unique constraint for 'nom' and 'saison_id'
ALTER TABLE categorie ADD CONSTRAINT categorie_nom_saison_id_key UNIQUE (nom, saison_id);
@@ -0,0 +1,11 @@
-- adherent modifications
ALTER TABLE adherent DROP COLUMN IF EXISTS adresse;
ALTER TABLE adherent ADD COLUMN lieu_naissance_ville VARCHAR(100);
ALTER TABLE adherent ADD COLUMN lieu_naissance_pays VARCHAR(100);
ALTER TABLE adherent ADD COLUMN nationalite VARCHAR(100);
-- pre_inscription modifications
ALTER TABLE pre_inscription DROP COLUMN IF EXISTS adresse;
ALTER TABLE pre_inscription ADD COLUMN lieu_naissance_ville VARCHAR(100);
ALTER TABLE pre_inscription ADD COLUMN lieu_naissance_pays VARCHAR(100);
ALTER TABLE pre_inscription ADD COLUMN nationalite VARCHAR(100);
@@ -0,0 +1,2 @@
ALTER TABLE licence ADD COLUMN type_demande VARCHAR(50);
ALTER TABLE licence ADD COLUMN type_licence VARCHAR(50);
@@ -0,0 +1,18 @@
-- Default values for existing records in adherent
UPDATE adherent SET lieu_naissance_ville = 'Non renseigné' WHERE lieu_naissance_ville IS NULL;
UPDATE adherent SET lieu_naissance_pays = 'France' WHERE lieu_naissance_pays IS NULL;
UPDATE adherent SET nationalite = 'Française' WHERE nationalite IS NULL;
-- Default values for existing records in pre_inscription
UPDATE pre_inscription SET lieu_naissance_ville = 'Non renseigné' WHERE lieu_naissance_ville IS NULL;
UPDATE pre_inscription SET lieu_naissance_pays = 'France' WHERE lieu_naissance_pays IS NULL;
UPDATE pre_inscription SET nationalite = 'Française' WHERE nationalite IS NULL;
-- Now make them NOT NULL
ALTER TABLE adherent ALTER COLUMN lieu_naissance_ville SET NOT NULL;
ALTER TABLE adherent ALTER COLUMN lieu_naissance_pays SET NOT NULL;
ALTER TABLE adherent ALTER COLUMN nationalite SET NOT NULL;
ALTER TABLE pre_inscription ALTER COLUMN lieu_naissance_ville SET NOT NULL;
ALTER TABLE pre_inscription ALTER COLUMN lieu_naissance_pays SET NOT NULL;
ALTER TABLE pre_inscription ALTER COLUMN nationalite SET NOT NULL;
@@ -0,0 +1,11 @@
-- Provide fallback email if null
UPDATE adherent SET email = 'nonrenseigne@example.com' WHERE email IS NULL OR email = '';
UPDATE pre_inscription SET email = 'nonrenseigne@example.com' WHERE email IS NULL OR email = '';
-- Make email NOT NULL
ALTER TABLE adherent ALTER COLUMN email SET NOT NULL;
ALTER TABLE pre_inscription ALTER COLUMN email SET NOT NULL;
-- Remove telephone
ALTER TABLE adherent DROP COLUMN IF EXISTS telephone;
ALTER TABLE pre_inscription DROP COLUMN IF EXISTS telephone;