- Ajout des champs password et salt dans user
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m25s
Build and test backend / Test-backend (pull_request) Successful in 2m1s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 25s
Build and test FrontEnd / Test-frontend (pull_request) Successful in 23s

- Ajout de la table token
- Ajout des foreign keys
This commit is contained in:
LeoMoulin 2024-03-05 14:14:56 +01:00
parent cc89d7f5b7
commit c27c3ac9fb
6 changed files with 76 additions and 14 deletions

View File

@ -1,16 +1,17 @@
package ovh.herisson.Clyde.Tables; package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity; import jakarta.persistence.*;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity @Entity
public class CursusCourse { public class CursusCourse {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@JoinColumn(name = "Cursus")
private int cursusId; private int cursusId;
@JoinColumn(name = "Course")
private int courseId; private int courseId;
public CursusCourse(int cursusId, int courseId){ public CursusCourse(int cursusId, int courseId){

View File

@ -1,15 +1,14 @@
package ovh.herisson.Clyde.Tables; package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity; import jakarta.persistence.*;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity @Entity
public class Secretary { public class Secretary {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@JoinColumn(name = "User")
private int regNo; private int regNo;
private String faculty; private String faculty;

View File

@ -1,16 +1,17 @@
package ovh.herisson.Clyde.Tables; package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity; import jakarta.persistence.*;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity @Entity
public class TeacherGivenCourse { public class TeacherGivenCourse {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@JoinColumn(name = "User")
private int regNo; private int regNo;
@JoinColumn(name = "Course")
private int courseId; private int courseId;
//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)

View File

@ -0,0 +1,41 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Token {
@GeneratedValue(strategy = GenerationType.AUTO)
@Id
private int id;
private int regNo;
private String data;
public Token(int regNo, String data){
this.regNo = regNo;
this.data = data;
}
public Token(){}
public int getId() {
return id;
}
public int getRegNo() {
return regNo;
}
public void setRegNo(int regNo) {
this.regNo = regNo;
}
public String getData(){
return data;
}
public void setData(String data) {
this.data = data;
}
}

View File

@ -22,8 +22,8 @@ public class User {
private Date birthDate; private Date birthDate;
private ovh.herisson.Clyde.Tables.Role role; private ovh.herisson.Clyde.Tables.Role role;
private String password; private String password;
private String salt;
public User(String lastName, String firstName, String email, String adress, String country, Date birthDate, Role role){ public User(String lastName, String firstName, String email, String adress, String country, Date birthDate, Role role, String password, String salt){
this.lastName = lastName; this.lastName = lastName;
this.firstName = firstName; this.firstName = firstName;
this.email = email; this.email = email;
@ -31,6 +31,8 @@ public class User {
this.country = country; this.country = country;
this.birthDate = birthDate; this.birthDate = birthDate;
this.role = role; this.role = role;
this.password = password;
this.salt = salt;
} }
public User() {} public User() {}
@ -93,4 +95,19 @@ public class User {
public void setRole(ovh.herisson.Clyde.Tables.Role role) { public void setRole(ovh.herisson.Clyde.Tables.Role role) {
this.role = role; this.role = role;
} }
public String getPassword(){
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSalt(){
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
} }

View File

@ -8,7 +8,10 @@ public class UserCursus {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private int id; private int id;
@JoinColumn(name = "User")
private int regNo; private int regNo;
@JoinColumn(name = "Cursus")
private int cursusId; private int cursusId;
public UserCursus(int regNo, int cursusId){ public UserCursus(int regNo, int cursusId){