feat: add data model for licence

This commit is contained in:
Thibaut Valentin 2024-02-03 19:23:37 +01:00
parent 58c2134e35
commit c6130cf65f
5 changed files with 64 additions and 6 deletions

View File

@ -0,0 +1,26 @@
package fr.titionfire.ffsaf.data.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.persistence.*;
import lombok.*;
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection
@Entity
@Table(name = "affiliation")
public class AffiliationModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "club", referencedColumnName = "id")
ClubModel club;
int saison;
}

View File

@ -5,6 +5,7 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.persistence.*;
import lombok.*;
import java.util.List;
import java.util.Map;
@Getter
@ -49,4 +50,7 @@ public class ClubModel {
String no_affiliation;
boolean international;
@OneToMany(mappedBy = "club", fetch = FetchType.EAGER)
List<AffiliationModel> affiliations;
}

View File

@ -0,0 +1,30 @@
package fr.titionfire.ffsaf.data.model;
import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.persistence.*;
import lombok.*;
@Getter
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@RegisterForReflection
@Entity
@Table(name = "licence")
public class LicenceModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "membre", referencedColumnName = "id")
MembreModel membre;
int saison;
boolean certificate;
boolean validate;
}

View File

@ -9,6 +9,7 @@ import jakarta.persistence.*;
import lombok.*;
import java.util.Date;
import java.util.List;
@Getter
@Setter
@ -51,4 +52,7 @@ public class MembreModel {
GradeArbitrage grade_arbitrage;
String url_photo;
@OneToMany(mappedBy = "membre", fetch = FetchType.EAGER)
List<LicenceModel> licences;
}

View File

@ -49,10 +49,4 @@ public class ClubEntity {
.international(model.isInternational())
.build();
}
public ClubModel toModel () {
return new ClubModel(this.id, this.clubId, this.name, this.country, this.shieldURL, this.contact, this.training_location,
this.training_day_time, this.contact_intern, this.RNA, this.SIRET, this.no_affiliation,
this.international);
}
}