added DELETE user and prepared tables for cascade deletion
This commit is contained in:
		| @ -32,6 +32,7 @@ public class AuthenticatorService { | ||||
|     } | ||||
|  | ||||
|     public InscriptionRequest register(InscriptionRequest inscriptionRequest) { | ||||
|         inscriptionRequest.setState(RequestState.Pending); | ||||
|         return inscriptionService.save(inscriptionRequest); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -126,4 +126,8 @@ public class UserService { | ||||
|     public User getUserById(long id) { | ||||
|         return userRepo.findById(id); | ||||
|     } | ||||
|  | ||||
|     public void delete(User user) { | ||||
|         userRepo.delete(user); | ||||
|     } | ||||
| } | ||||
| @ -1,6 +1,8 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import org.hibernate.annotations.OnDelete; | ||||
| import org.hibernate.annotations.OnDeleteAction; | ||||
|  | ||||
| @Entity | ||||
| public class CurriculumCourse { | ||||
| @ -10,9 +12,11 @@ public class CurriculumCourse { | ||||
|  | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @JoinColumn(name = "Curriculum") | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     private Curriculum curriculum; | ||||
|  | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     @JoinColumn(name = "Course") | ||||
|     private Course course; | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import org.hibernate.annotations.OnDelete; | ||||
| import org.hibernate.annotations.OnDeleteAction; | ||||
|  | ||||
| @Entity | ||||
| public class ReInscriptionRequest { | ||||
| @ -10,10 +12,12 @@ public class ReInscriptionRequest { | ||||
|  | ||||
|     @ManyToOne | ||||
|     @JoinColumn(name = "Users") | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     private User user; | ||||
|  | ||||
|     @ManyToOne | ||||
|     @JoinColumn(name = "Curriculum") | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     private Curriculum newCurriculum; | ||||
|     private RequestState state; | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import org.hibernate.annotations.OnDelete; | ||||
| import org.hibernate.annotations.OnDeleteAction; | ||||
|  | ||||
| @Entity | ||||
| public class TeacherCourse { | ||||
| @ -9,11 +11,13 @@ public class TeacherCourse { | ||||
|     private int id; | ||||
|  | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     @JoinColumn(name = "Users") | ||||
|     private User user; | ||||
|  | ||||
|  | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     @JoinColumn(name = "Course") | ||||
|     private Course course; | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import org.hibernate.annotations.OnDelete; | ||||
| import org.hibernate.annotations.OnDeleteAction; | ||||
|  | ||||
| import java.util.Date; | ||||
|  | ||||
| @ -11,6 +13,7 @@ public class Token { | ||||
|     private int id; | ||||
|  | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     @JoinColumn(name ="Users") | ||||
|     private User user; | ||||
|     private String token; | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import org.hibernate.annotations.OnDelete; | ||||
| import org.hibernate.annotations.OnDeleteAction; | ||||
|  | ||||
| @Entity | ||||
| public class UserCurriculum { | ||||
| @ -10,10 +12,11 @@ public class UserCurriculum { | ||||
|  | ||||
|     //Un étudiant peut avoir plusieurs curriculums | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @OnDelete(action = OnDeleteAction.CASCADE) | ||||
|     @JoinColumn(name = "Users") | ||||
|     private User user; | ||||
|  | ||||
|     @OneToOne(fetch = FetchType.EAGER) | ||||
|     @ManyToOne(fetch = FetchType.EAGER) | ||||
|     @JoinColumn(name = "Curriculum") | ||||
|     private Curriculum curriculum; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user