From 02afc3df477b18c73479a63d1aa2d6f5f403bf3e Mon Sep 17 00:00:00 2001 From: LeoMoulin Date: Sat, 9 Mar 2024 12:40:02 +0100 Subject: [PATCH] =?UTF-8?q?-=20Cr=C3=A9ation=20de=20la=20table=20qui=20sto?= =?UTF-8?q?cke=20les=20demandes=20d'inscriptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Création de la table qui stocke les demandes de réinscription - Création d'un enum pour les états des requetes --- .../Clyde/Tables/InscriptionRequest.java | 108 ++++++++++++++++++ .../Clyde/Tables/ReinscriptionRequest.java | 69 +++++++++++ .../herisson/Clyde/Tables/RequestState.java | 7 ++ 3 files changed, 184 insertions(+) create mode 100644 backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java create mode 100644 backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java create mode 100644 backend/src/main/java/ovh/herisson/Clyde/Tables/RequestState.java diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java new file mode 100644 index 0000000..2e5bf0d --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java @@ -0,0 +1,108 @@ +package ovh.herisson.Clyde.Tables; + +import jakarta.persistence.*; + +import java.util.Date; + +public class InscriptionRequest { + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + private String firstName; + private String lastName; + private String adress; + private String email; + private String country; + private Date birthDate; + + @ManyToOne + @JoinColumn(name="Cursus") + private Cursus cursus; + private RequestState state; + private String profilePicture; + public InscriptionRequest(){} + public InscriptionRequest(String lastName, String firstName, String adress, String email, String country, Date birthDate, RequestState state, String profilePicture){ + this.lastName = lastName; + this.firstName = firstName; + this.adress = adress; + this.email = email; + this.country = country; + this.birthDate = birthDate; + this.state = state; + } + + public int getId() { + return id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getAdress() { + return adress; + } + + public void setAdress(String adress) { + this.adress = adress; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public Date getBirthDate() { + return birthDate; + } + + public void setBirthDate(Date birthDate) { + this.birthDate = birthDate; + } + + public Cursus getCursus() { + return cursus; + } + + public void setCursus(Cursus cursus) { + this.cursus = cursus; + } + + public RequestState getState() { + return state; + } + + public void setState(RequestState state) { + this.state = state; + } + + public String getProfilePicture() { + return profilePicture; + } + + public void setProfilePicture(String profilePicture) { + this.profilePicture = profilePicture; + } +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java new file mode 100644 index 0000000..8a56f88 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java @@ -0,0 +1,69 @@ +package ovh.herisson.Clyde.Tables; + +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; + +public class ReinscriptionRequest { + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @ManyToOne + @JoinColumn(name = "User") + private User user; + + @ManyToOne + @JoinColumn(name = "Cursus") + private Cursus newCursus; + private RequestState state; + + //Permet de différencier les demandes de changement et une réinscription dans le même cursus + //Pour la réinscription on va le mettre a 0 + private boolean type; + + public ReinscriptionRequest(){} + + public ReinscriptionRequest(User user, Cursus newCursus, RequestState state, boolean type){ + this.user = user; + this.newCursus = newCursus; + this.state = state; + this.type = type; + } + + public int getId() { + return id; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public Cursus getNewCursus() { + return newCursus; + } + + public void setNewCursus(Cursus newCursus) { + this.newCursus = newCursus; + } + + public RequestState getState() { + return state; + } + + public void setState(RequestState state) { + this.state = state; + } + + public boolean isType() { + return type; + } + + public void setType(boolean type) { + this.type = type; + } +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/RequestState.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/RequestState.java new file mode 100644 index 0000000..f0345c1 --- /dev/null +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/RequestState.java @@ -0,0 +1,7 @@ +package ovh.herisson.Clyde.Tables; + +public enum RequestState { + Accepted, + Refused, + Pending; +}