LeoMoulin/Backend/Leo #55
@ -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;
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						Maxime
						commented  
			
		data ? peut-être être plus précis dans le nom ? data ? peut-être être plus précis dans le nom ? 
			
			
		
				
					
						LeoMoulin
						commented  
			
		Je vais juste le rename en token comme ca c'est plié ! Je vais juste le rename en token comme ca c'est plié ! 
			
			
		 | 
			||||
 | 
			
		||||
    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;
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
				
					
						Maxime
						commented  
			
		Pas Salt ! Pas 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
	
Pourquoi pas directement un User ici ? où y'a pas moyen de faire un link vers la table Users ?
J'ai suivi les champs de la table ! J'ai aussi oublié de le mettre en foreign key c'est vrai je vais faire ca j'avoues que j'ai pas pensé a mettre directement une référence vers un objet user j'avoues que je ne sais pas comment ca va se comporter je vais essayer d'approfondir.
Ok check comme ça si on peut chopper le User en une seule query sans pour autant stocker une deuxième fois la table User C parfait