126 lines
3.2 KiB
Java
126 lines
3.2 KiB
Java
package com.pmu.betengine.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import com.pmu.betengine.model.statut.StatutCourse;
|
|
import jakarta.persistence.*;
|
|
import jakarta.validation.constraints.Pattern;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Builder;
|
|
import lombok.Data;
|
|
import lombok.NoArgsConstructor;
|
|
|
|
import java.sql.Date;
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Data
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
@Table(name = "course")
|
|
public class Course {
|
|
@Id
|
|
@GeneratedValue
|
|
private Long id;
|
|
|
|
private String type;
|
|
|
|
private Integer numero;
|
|
|
|
private String nom;
|
|
|
|
@Column(name = "date_depart_course")
|
|
private LocalDateTime dateDepartCourse;
|
|
|
|
@Column(name = "date_debut_paris")
|
|
private LocalDateTime dateDebutParis;
|
|
|
|
@Column(name = "date_fin_paris")
|
|
private LocalDateTime dateFinParis;
|
|
|
|
@Column(name = "reunion_id")
|
|
private Long reunionId;
|
|
|
|
@Column(name = "reunion_course")
|
|
private Integer reunionCourse;
|
|
|
|
private String particularite;
|
|
|
|
private Integer partants;
|
|
|
|
private Integer distance;
|
|
|
|
private String condition;
|
|
|
|
private boolean estTerminee;
|
|
private boolean estAnnulee;
|
|
private boolean aDeadHeat;
|
|
|
|
private String statut;
|
|
|
|
private int nombreChevauxInscrits;
|
|
|
|
@Column(name = "resultat_statut")
|
|
private String resultatStatut;
|
|
|
|
@Column(name = "created_by")
|
|
private String createdBy;
|
|
|
|
@Column(name = "validated_by")
|
|
private String validatedBy;
|
|
|
|
@Column(name = "created_at")
|
|
private LocalDateTime createdAt;
|
|
|
|
@Column(name = "updated_at")
|
|
private LocalDateTime updatedAt;
|
|
|
|
@OneToMany(mappedBy = "course", cascade = CascadeType.ALL)
|
|
private List<NonPartant> nonPartants;
|
|
|
|
|
|
}
|
|
|
|
|
|
// public class Course {
|
|
// @Id
|
|
// @GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
// private Long id;
|
|
// private String numero;
|
|
|
|
// // FIX 1: Changement de @OneToOne à @ManyToOne (Une course appartient à une seule réunion)
|
|
// @ManyToOne
|
|
// @JoinColumn(name = "reunion_id", nullable = false)
|
|
// private Reunion reunion;
|
|
|
|
// @JsonFormat(pattern = "dd/MM/yyyy HH:mm:ss", shape = JsonFormat.Shape.STRING)
|
|
// @Column(name = "heure_course")
|
|
// private LocalDateTime heureCourse;
|
|
// private String lieu;
|
|
// private int nombreChevauxInscrits;
|
|
// private boolean estTerminee;
|
|
// private boolean estAnnulee;
|
|
// private boolean aDeadHeat;
|
|
|
|
// @Enumerated(EnumType.STRING)
|
|
// private StatutCourse statut;
|
|
|
|
// @OneToOne(mappedBy = "course")
|
|
// private Resultat resultat;
|
|
|
|
// @OneToMany(fetch = FetchType.LAZY)
|
|
// @JoinTable(name = "course_chevaux",
|
|
// joinColumns = @JoinColumn(name = "course_id"),
|
|
// inverseJoinColumns = @JoinColumn(name = "cheval_id"))
|
|
// private List<Cheval> chevaux;
|
|
|
|
// @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy = "course")
|
|
// private List<Pari> paris;
|
|
|
|
// public boolean estEligiblePourTrioOrdre() {
|
|
// return chevaux != null && chevaux.size() >= 3 && chevaux.size() <= 7;
|
|
// }
|
|
// } |