1
0
forked from PGL/Clyde

Implémentation des différentes classes représentants les tables

This commit is contained in:
LeoMoulin 2024-02-29 20:08:12 +01:00
parent 7c9fe9235c
commit 69c3a3b965
10 changed files with 150 additions and 0 deletions

View File

@ -19,6 +19,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-jdbc")
implementation("org.springframework.boot:spring-boot-starter-mail")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
// implementation("org.springframework.session:spring-session-jdbc")
developmentOnly("org.springframework.boot:spring-boot-devtools")
developmentOnly("org.springframework.boot:spring-boot-docker-compose")

View File

@ -0,0 +1,16 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int CourseID;
private int Credits;
private String Title;
private String Faculty;
}

View File

@ -0,0 +1,16 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Cursus {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int CursusId;
private int Year;
private String Option;
}

View File

@ -0,0 +1,16 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class CursusCourse {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private int CursusId;
private int CourseId;
}

View File

@ -0,0 +1,7 @@
package ovh.herisson.Clyde.Tables;
public enum Role {
Teacher,
Student;
}

View File

@ -0,0 +1,15 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Secretary {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private int RegNo;
private String Faculty;
}

View File

@ -0,0 +1,15 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class TeacherGivenCourse {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private int RegNo;
private int CourseId;
}

View File

@ -0,0 +1,16 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class TeacherOwnerCourse {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private int RegNo;
private int CourseId;
}

View File

@ -0,0 +1,35 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.*;
import java.util.Date;
//Classe représentant un utilisateur l'attribut password demande surement un peu de rafinement niveau sécurité
//et l'attribut tokenApi doit encore être ajouté vu qu'il faut en discuter
@Entity
//Je rajoute un s au nom de la table pour éviter les conflits avec les mots réservés
@Table(name = "Users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int RegNo;
private String LastName;
private String FirstName;
private String Email;
private String Adress;
private String Country;
private Date BirthDate;
private ovh.herisson.Clyde.Tables.Role Role;
private String Password;
public User(String LastName, String FirstName){
this.LastName = LastName;
this.FirstName = FirstName;
}
public User() {
}
}

View File

@ -0,0 +1,13 @@
package ovh.herisson.Clyde.Tables;
import jakarta.persistence.*;
@Entity
@Table(name = "User_Cursus")
public class UserCursus {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private int RegNo;
private int CursusId;
}