- Ajout des champs password et salt dans user
- Ajout de la table token - Ajout des foreign keys
This commit is contained in:
		| @ -1,16 +1,17 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.GeneratedValue; | ||||
| import jakarta.persistence.GenerationType; | ||||
| import jakarta.persistence.Id; | ||||
| import jakarta.persistence.*; | ||||
|  | ||||
| @Entity | ||||
| public class CursusCourse { | ||||
|     @Id | ||||
|     @GeneratedValue(strategy = GenerationType.AUTO) | ||||
|     private int id; | ||||
|  | ||||
|     @JoinColumn(name = "Cursus") | ||||
|     private int cursusId; | ||||
|  | ||||
|     @JoinColumn(name = "Course") | ||||
|     private int courseId; | ||||
|  | ||||
|     public CursusCourse(int cursusId, int courseId){ | ||||
|  | ||||
| @ -1,15 +1,14 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.GeneratedValue; | ||||
| import jakarta.persistence.GenerationType; | ||||
| import jakarta.persistence.Id; | ||||
| import jakarta.persistence.*; | ||||
|  | ||||
| @Entity | ||||
| public class Secretary { | ||||
|     @Id | ||||
|     @GeneratedValue(strategy = GenerationType.AUTO) | ||||
|     private int id; | ||||
|  | ||||
|     @JoinColumn(name = "User") | ||||
|     private int regNo; | ||||
|     private String faculty; | ||||
|  | ||||
|  | ||||
| @ -1,16 +1,17 @@ | ||||
| package ovh.herisson.Clyde.Tables; | ||||
|  | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.GeneratedValue; | ||||
| import jakarta.persistence.GenerationType; | ||||
| import jakarta.persistence.Id; | ||||
| import jakarta.persistence.*; | ||||
|  | ||||
| @Entity | ||||
| public class TeacherGivenCourse { | ||||
|     @Id | ||||
|     @GeneratedValue(strategy = GenerationType.AUTO) | ||||
|     private int id; | ||||
|  | ||||
|     @JoinColumn(name = "User") | ||||
|     private int regNo; | ||||
|  | ||||
|     @JoinColumn(name = "Course") | ||||
|     private int courseId; | ||||
|  | ||||
|     //This flag helps make the difference between an assistant or a Teacher (who owns the course) | ||||
|  | ||||
							
								
								
									
										41
									
								
								backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								backend/src/main/java/ovh/herisson/Clyde/Tables/Token.java
									
									
									
									
									
										Normal 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; | ||||
|     } | ||||
| } | ||||
| @ -22,8 +22,8 @@ public class User { | ||||
|     private Date birthDate; | ||||
|     private ovh.herisson.Clyde.Tables.Role role; | ||||
|     private String password; | ||||
|  | ||||
|     public User(String lastName, String firstName, String email, String adress, String country, Date birthDate, Role role){ | ||||
|     private String salt; | ||||
|     public User(String lastName, String firstName, String email, String adress, String country, Date birthDate, Role role, String password, String salt){ | ||||
|         this.lastName = lastName; | ||||
|         this.firstName = firstName; | ||||
|         this.email = email; | ||||
| @ -31,6 +31,8 @@ public class User { | ||||
|         this.country = country; | ||||
|         this.birthDate = birthDate; | ||||
|         this.role = role; | ||||
|         this.password = password; | ||||
|         this.salt = salt; | ||||
|     } | ||||
|  | ||||
|     public User() {} | ||||
| @ -93,4 +95,19 @@ public class User { | ||||
|     public void setRole(ovh.herisson.Clyde.Tables.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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -8,7 +8,10 @@ public class UserCursus { | ||||
|     @Id | ||||
|     @GeneratedValue(strategy = GenerationType.AUTO) | ||||
|     private int id; | ||||
|     @JoinColumn(name = "User") | ||||
|     private int regNo; | ||||
|  | ||||
|     @JoinColumn(name = "Cursus") | ||||
|     private int cursusId; | ||||
|  | ||||
|     public UserCursus(int regNo, int cursusId){ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user