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