diff --git a/epf-front-skeleton-main/src/app/models/course.model.ts b/epf-front-skeleton-main/src/app/models/course.model.ts index dc3734a1412a73b6aa837948700d76e0c15b32f5..1a1b7664725f2cf16bd22f4cdb7736cf46ab4d8e 100644 --- a/epf-front-skeleton-main/src/app/models/course.model.ts +++ b/epf-front-skeleton-main/src/app/models/course.model.ts @@ -1,9 +1,4 @@ -export class Course { +export interface Course { name: string hours: number - - constructor(name: string, hours: number) { - this.name = name - this.hours = hours - } } diff --git a/epf-front-skeleton-main/src/app/models/links.model.ts b/epf-front-skeleton-main/src/app/models/links.model.ts index 2538d90c72b1db4300ec93301a2f543d78ef19f1..891c05bf1e89e603fed7605138a136fb4858f50d 100644 --- a/epf-front-skeleton-main/src/app/models/links.model.ts +++ b/epf-front-skeleton-main/src/app/models/links.model.ts @@ -1,9 +1,4 @@ -export class Link { +export interface Link { name: string href: string - - constructor(name: string, href: string) { - this.name = name - this.href = href - } } diff --git a/epf-front-skeleton-main/src/app/models/major.model.ts b/epf-front-skeleton-main/src/app/models/major.model.ts index f572a9a24587605f5cafa4a6468b6feaa552b3b2..658cc04efb748a0882682c0872df15ddb6c6429b 100644 --- a/epf-front-skeleton-main/src/app/models/major.model.ts +++ b/epf-front-skeleton-main/src/app/models/major.model.ts @@ -1,14 +1,8 @@ import { Student } from "./student.model" -export class Major { +export interface Major { id?: bigint name: string description: string - students: Student[] = [] - - constructor(name: string, description: string, id?: bigint) { - this.name = name - this.description = description - this.id = id - } + students: Student[] } diff --git a/epf-front-skeleton-main/src/app/models/student.model.ts b/epf-front-skeleton-main/src/app/models/student.model.ts index 0a107361630575cc5dad4c1ed5c572dd42276b12..cc9283a5b71789474672a1eec4bf977e734fc7fe 100644 --- a/epf-front-skeleton-main/src/app/models/student.model.ts +++ b/epf-front-skeleton-main/src/app/models/student.model.ts @@ -1,20 +1,11 @@ import { Course } from "./course.model" import { Major } from "./major.model" -export class Student { +export interface Student { id?: bigint firstName: string lastName: string birthDate?: Date courses?: Course[] major: Major - - constructor(firstName: string, lastName: string, major: Major, birthDate?: Date, courses?: Course[], id?: bigint) { - this.id = id - this.firstName = firstName - this.lastName = lastName - this.birthDate = birthDate - this.courses = courses - this.major = major - } } diff --git a/epf-front-skeleton-main/src/app/navbar/navbar.component.ts b/epf-front-skeleton-main/src/app/navbar/navbar.component.ts index 6e039d549fadd4470ff083afabf00fa2ee668de7..30d67f01559c44a606d44e46888af85df393e65c 100644 --- a/epf-front-skeleton-main/src/app/navbar/navbar.component.ts +++ b/epf-front-skeleton-main/src/app/navbar/navbar.component.ts @@ -10,8 +10,8 @@ export class NavbarComponent implements OnInit { links: Link[] = [] constructor() { - this.links.push(new Link("Students", "students")) - this.links.push(new Link("Majors", "majors")) + this.links.push({ name: "Students", href: "students" }) + this.links.push({ name: "Majors", href: "majors" }) } ngOnInit(): void { diff --git a/epf-front-skeleton-main/src/app/services/constantsMock.service.ts b/epf-front-skeleton-main/src/app/services/constantsMock.service.ts index 9819e7610df27ddafcb3881414b8c278e080822f..17bd42bf05a0993b0157dc6ef34cca8ea3ef6ed7 100644 --- a/epf-front-skeleton-main/src/app/services/constantsMock.service.ts +++ b/epf-front-skeleton-main/src/app/services/constantsMock.service.ts @@ -10,38 +10,66 @@ export class ConstantsMockService { constructor() { } - private spanish = new Course("Spanish", 2) - private german = new Course("German", 2) - private ioT = new Course("Internet Of Things", 15) - private termo = new Course("Thermodynamic", 10) - private anatomie = new Course("Anatomy", 7) - private java = new Course("Java", 15) - private math = new Course("Maths", 30) - private management = new Course("Lean Management", 30) + private spanish: Course = {name: "Spanish", hours: 2} + private german: Course = {name: "German", hours: 2} + private ioT: Course = {name: "Internet Of Things", hours: 15} + private termo: Course = {name: "Thermodynamic", hours: 10} + private anatomie: Course = {name: "Anatomy", hours: 7} + private java: Course = {name: "Java", hours: 15} + private math: Course = {name: "Maths", hours: 30} + private management: Course = {name: "Lean Management", hours: 30} - private min = new Major("Ingéniérie du Numérique", "Des lignes de code partout !!", 1n) - private msm = new Major("Structure & Matériaux", "Beaucoup de béton et des poutres (snif elle a été renomée)", 2n) + private min: Major = {name: "Ingéniérie du Numérique", description: "Des lignes de code partout !!", id: 1n, students: []} + private msm: Major = {name: "Structure & Matériaux", description: "Beaucoup de béton et des poutres (snif elle a été renomée)", id: 2n, students: []} - private mae = new Major("Aéronautique & Espace", "Vive le vent", 3n) - private mde = new Major("Data Engineering", "Trop cool plein de données à ordonner", 4n) - private mee = new Major("Energie & Environnement", "On est full green", 5n) - private mem = new Major("Engineering Management", "Des managers de qualité", 6n) - private mis = new Major("Ingénierie & Santé", "On connait tous les os et tous les muscles du corps humain", 7n) - private miad = new Major("Ingénierie & Architecture durable", "Objectif 0 carbon", 8n) - private mdid = new Major("Design Industriel Durable", "Ca existait pas pour la P2022 ça", 9n) + private mae: Major = {name: "Aéronautique & Espace", description: "Vive le vent", id: 3n, students: []} + private mde: Major = {name: "Data Engineering", description: "Trop cool plein de données à ordonner", id: 4n, students: []} + private mee: Major = {name: "Energie & Environnement", description: "On est full green", id: 5n, students: []} + private mem: Major = {name: "Engineering Management", description: "Des managers de qualité", id: 6n, students: []} + private mis: Major = {name: "Ingénierie & Santé", description: "On connait tous les os et tous les muscles du corps humain", id: 7n, students: []} + private miad: Major = {name: "Ingénierie & Architecture durable", description: "Objectif 0 carbon", id: 8n, students: []} + private mdid: Major = {name: "Design Industriel Durable", description: "Ca existait pas pour la P2022 ça", id: 9n, students: []} - student1 = new Student("Harry", "Cover", this.mem, new Date("1998-10-10"), [this.spanish, this.management], 1n) - student2 = new Student("Jacques", "Climate", this.mee, new Date("1999-11-07"), [this.german, this.termo], 2n) - student3 = new Student("Alain", "Parfait", this.min, new Date("1999-04-12"), [this.german, this.ioT, this.java], 3n) - student4 = new Student("Cathy", "Mini", this.mde, new Date("1999-05-12"), [this.spanish, this.math, this.java], 4n) - student5 = new Student( - "Côme", - "Toulemonde", - this.mis, - new Date("1999-07-16"), - [this.spanish, this.anatomie, this.math], - 5n, - ) + private student1: Student = { + firstName: "Harry", + lastName: "Cover", + major: this.mem, + birthDate: new Date("1998-10-10"), + courses: [this.german, this.termo], + id: 1n, + } + private student2: Student = { + firstName: "Jacques", + lastName: "Climate", + major: this.mee, + birthDate: new Date("1999-11-07"), + courses: [this.german, this.termo], + id: 2n, + } + private student3: Student = { + firstName: "Alain", + lastName: "Parfait", + major: this.min, + birthDate: new Date("1999-04-12"), + courses: [this.german, this.ioT, this.java], + id: 3n, + } + private student4: Student = { + firstName: "Cathy", + lastName: "Mini", + major: this.mde, + birthDate: new Date("1999-05-12"), + courses: [this.spanish, this.math, this.java], + id: 4n, + } + private student5: Student = { + firstName: "Côme", + lastName: "Toulemonde", + major: this.mis, + birthDate: new Date("1999-07-16"), + courses: [this.spanish, this.anatomie, this.math], + id: 5n, + } students: Student[] = [this.student1, this.student2, this.student3, this.student4, this.student5] majors: Major[] = [this.min, this.msm, this.mae, this.mde, this.mee, this.mem, this.mis, this.miad, this.mdid] diff --git a/epf-front-skeleton-main/src/app/students/student-details/student-details.resolver.ts b/epf-front-skeleton-main/src/app/students/student-details/student-details.resolver.ts index 7d971f9157c8515c5be7d625fb3b56f75cd29cbd..57808c25414f266c6323998f3e945b14143ae20d 100644 --- a/epf-front-skeleton-main/src/app/students/student-details/student-details.resolver.ts +++ b/epf-front-skeleton-main/src/app/students/student-details/student-details.resolver.ts @@ -14,7 +14,7 @@ export class StudentDetailsResolver implements Resolve<Student> { resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Student> { if (route.params["id"] == "new") { - return new Observable((observer) => observer.next(new Student("", "", new Major("", "")))) + return new Observable((observer) => observer.next({firstName: "", lastName: "", major: {name: "", description: "", students: []}})) } return this.studentService.findById(parseInt(route.paramMap.get("id")!!, 10)) }