Merge branch 'Leo/Backend' into Max/Backend/loginApi
Some checks failed
Build and test backend / Build-backend (pull_request) Failing after 1m36s
Build and test backend / Test-backend (pull_request) Failing after 1m35s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 20s

This commit is contained in:
LeoMoulin 2024-03-07 20:53:33 +01:00
commit 3b31fa794f
5 changed files with 64 additions and 47 deletions

View File

@ -8,15 +8,17 @@ public class CursusCourse {
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Cursus")
private int cursusId;
private Cursus cursus;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Course")
private int courseId;
private Course course;
public CursusCourse(int cursusId, int courseId){
this.cursusId = cursusId;
this.courseId = courseId;
public CursusCourse(Cursus cursus, Course course){
this.cursus = cursus;
this.course = course;
}
public CursusCourse() {}
@ -25,19 +27,19 @@ public class CursusCourse {
return id;
}
public int getCourseId() {
return courseId;
public Course getCourse() {
return course;
}
public void setCourseId(int courseId){
this.courseId = courseId;
public void setCourse(Course course){
this.course = course;
}
public int getCursusId() {
return cursusId;
public Cursus getCursus() {
return cursus;
}
public void setCursusId(int cursusId) {
this.cursusId = cursusId;
public void setCursus(Cursus cursus) {
this.cursus = cursus;
}
}

View File

@ -8,12 +8,13 @@ public class Secretary {
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users")
private int regNo;
private User user;
private String faculty;
public Secretary(int regNo, String faculty){
this.regNo = regNo;
public Secretary(User user, String faculty){
this.user = user;
this.faculty = faculty;
}
@ -23,12 +24,12 @@ public class Secretary {
return id;
}
public int getRegNo() {
return regNo;
public User getUser() {
return user;
}
public void setRegNo(int regNo) {
this.regNo = regNo;
public void setUser(User user) {
this.user = user;
}
public String getFaculty() {

View File

@ -8,18 +8,21 @@ public class TeacherGivenCourse {
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users")
private int regNo;
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Course")
private int courseId;
private Course course;
//This flag helps make the difference between an assistant or a Teacher (who owns the course)
private boolean owned;
public TeacherGivenCourse(int regNo, int courseId, boolean owned){
this.regNo = regNo;
this.courseId = courseId;
public TeacherGivenCourse(User user, Course course, boolean owned){
this.user = user;
this.course = course;
this.owned = owned;
}
@ -29,20 +32,20 @@ public class TeacherGivenCourse {
return id;
}
public int getRegNo() {
return regNo;
public User getUser() {
return user;
}
public void setRegNo(int regNo) {
this.regNo = regNo;
public void setUser(User user) {
this.user = user;
}
public int getCourseId() {
return courseId;
public Course getCourse() {
return course;
}
public void setCourseId(int courseId) {
this.courseId = courseId;
public void setCourse(Course course) {
this.course = course;
}
public boolean isOwned() {

View File

@ -20,15 +20,17 @@ public class User {
private String address;
private String country;
private Date birthDate;
private String profilePictureUrl;
private ovh.herisson.Clyde.Tables.Role role;
private String password;
public User(String lastName, String firstName, String email, String address, String country, Date birthDate, Role role, String password){
public User(String lastName, String firstName, String email, String address, String country, Date birthDate, String profilePictureUrl, Role role, String password){
this.lastName = lastName;
this.firstName = firstName;
this.email = email;
this.address = address;
this.country = country;
this.birthDate = birthDate;
this.profilePictureUrl = profilePictureUrl;
this.role = role;
this.password = password;
}
@ -86,6 +88,11 @@ public class User {
this.birthDate = birthDate;
}
public String getProfilePictureUrl(){return this.profilePictureUrl;}
public void setProfilePictureUrl(String profilePictureUrl){
this.profilePictureUrl = profilePictureUrl;
}
public ovh.herisson.Clyde.Tables.Role getRole() {
return role;
}

View File

@ -7,15 +7,19 @@ public class UserCursus {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
//Un étudiant peut avoir plusieurs cursus
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Users")
private int regNo;
private User user;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "Cursus")
private int cursusId;
private Cursus cursus;
public UserCursus(int regNo, int cursusId){
this.regNo = regNo;
this.cursusId = cursusId;
public UserCursus(User user, Cursus cursus){
this.user = user;
this.cursus = cursus;
}
public UserCursus() {}
@ -24,19 +28,19 @@ public class UserCursus {
return id;
}
public int getRegNo() {
return regNo;
public User getUser() {
return user;
}
public void setRegNo(int regNo) {
this.regNo = regNo;
public void setUser(User user) {
this.user = user;
}
public int getCursusId() {
return cursusId;
public Cursus getCursus() {
return cursus;
}
public void setCursusId(int cursusId) {
this.cursusId = cursusId;
public void setCursus(Cursus cursus) {
this.cursus = cursus;
}
}