Compare commits

...

3 Commits

Author SHA1 Message Date
3b31fa794f 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
2024-03-07 20:53:33 +01:00
c33b73a114 - Ajout de "l'url" de l'image dans User 2024-03-07 19:12:48 +01:00
434cc8dd2b - On objectise tout
- Ajout des relation
2024-03-06 20:05:24 +01:00
5 changed files with 64 additions and 47 deletions

View File

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

View File

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

View File

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

View File

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

View File

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