From c5d7ce41785be4156a3fbbbdd7a36fc11bc357b8 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 16 Mar 2024 20:31:03 +0100 Subject: [PATCH] cleaned the Entities --- .../Clyde/Tables/InscriptionRequest.java | 10 +++++++++- ...Request.java => ReInscriptionRequest.java} | 8 ++++---- .../herisson/Clyde/Tables/StorageFile.java | 1 - .../java/ovh/herisson/Clyde/Tables/Token.java | 2 -- .../java/ovh/herisson/Clyde/Tables/User.java | 19 ++----------------- 5 files changed, 15 insertions(+), 25 deletions(-) rename backend/src/main/java/ovh/herisson/Clyde/Tables/{ReinscriptionRequest.java => ReInscriptionRequest.java} (88%) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java index bc781be..b7bfea3 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/InscriptionRequest.java @@ -16,7 +16,7 @@ public class InscriptionRequest { private String country; private Date birthDate; - @ManyToOne + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name="Curriculum") private Curriculum curriculum; private RequestState state; @@ -112,4 +112,12 @@ public class InscriptionRequest { public void setProfilePicture(String profilePicture) { this.profilePicture = profilePicture; } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/ReInscriptionRequest.java similarity index 88% rename from backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java rename to backend/src/main/java/ovh/herisson/Clyde/Tables/ReInscriptionRequest.java index 57ad53c..9bd3fba 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/ReinscriptionRequest.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/ReInscriptionRequest.java @@ -3,7 +3,7 @@ package ovh.herisson.Clyde.Tables; import jakarta.persistence.*; @Entity -public class ReinscriptionRequest { +public class ReInscriptionRequest { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int id; @@ -21,16 +21,16 @@ public class ReinscriptionRequest { //Pour la réinscription on va le mettre a 0 private boolean type = false; - public ReinscriptionRequest(){} + public ReInscriptionRequest(){} - public ReinscriptionRequest(User user, Curriculum newCurriculum, RequestState state, boolean type){ + public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state, boolean type){ this.user = user; this.newCurriculum = newCurriculum; this.state = state; this.type = type; } - public ReinscriptionRequest(User user, Curriculum newCurriculum, RequestState state){ + public ReInscriptionRequest(User user, Curriculum newCurriculum, RequestState state){ this.user = user; this.newCurriculum = newCurriculum; this.state = state; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/StorageFile.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/StorageFile.java index afa7985..800d99a 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/StorageFile.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/StorageFile.java @@ -24,7 +24,6 @@ public class StorageFile { public StorageFile(){} - public void setId(Long id) { this.id = id; } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java index 8aa4c0e..29ef906 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java @@ -1,8 +1,6 @@ package ovh.herisson.Clyde.Tables; import jakarta.persistence.*; -import org.springframework.scheduling.annotation.Scheduled; -import ovh.herisson.Clyde.Repositories.TokenRepository; import java.util.Date; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java index 1f6aa3b..de958df 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/User.java @@ -1,11 +1,8 @@ package ovh.herisson.Clyde.Tables; import jakarta.persistence.*; - import java.util.Date; -//Classe représentant un utilisateur l'attribut password demande surement un peu de rafinement niveau sécurité -//et l'attribut tokenApi doit encore être ajouté vu qu'il faut en discuter @Entity @Table(name = "Users") @@ -37,18 +34,6 @@ public class User { this.password = password; } - - /** Constructor for the first registration request from a student (can't specify a Role) - * - * @param lastName - * @param firstName - * @param email - * @param address - * @param country - * @param birthDate - * @param profilePictureUrl - * @param password - */ public User(String lastName, String firstName, String email, String address, String country, Date birthDate, String profilePictureUrl, String password) { @@ -95,8 +80,8 @@ public class User { return address; } - public void setAddress(String adress) { - this.address = adress; + public void setAddress(String address) { + this.address = address; } public String getCountry() {