Merge branch 'dev' into test/testen-voor-datalaag-#87
This commit is contained in:
commit
79393d6552
161 changed files with 9836 additions and 3751 deletions
|
@ -3,31 +3,21 @@ import { Student } from '../users/student.entity.js';
|
|||
import { Class } from './class.entity.js';
|
||||
import { ClassJoinRequestRepository } from '../../data/classes/class-join-request-repository.js';
|
||||
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return ClassJoinRequestRepository;
|
||||
},
|
||||
})
|
||||
@Entity({ repository: () => ClassJoinRequestRepository })
|
||||
export class ClassJoinRequest {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
entity: () => Student,
|
||||
primary: true,
|
||||
})
|
||||
requester!: Student;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
entity: () => Class,
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
|
||||
@Enum(() => {
|
||||
return ClassJoinRequestStatus;
|
||||
})
|
||||
@Enum(() => ClassJoinRequestStatus)
|
||||
status!: ClassJoinRequestStatus;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
import {
|
||||
Collection,
|
||||
Entity,
|
||||
ManyToMany,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from '@mikro-orm/core';
|
||||
import { Collection, Entity, ManyToMany, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { v4 } from 'uuid';
|
||||
import { Teacher } from '../users/teacher.entity.js';
|
||||
import { Student } from '../users/student.entity.js';
|
||||
import { ClassRepository } from '../../data/classes/class-repository.js';
|
||||
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return ClassRepository;
|
||||
},
|
||||
})
|
||||
@Entity({ repository: () => ClassRepository })
|
||||
export class Class {
|
||||
@PrimaryKey()
|
||||
classId = v4();
|
||||
|
@ -22,13 +12,9 @@ export class Class {
|
|||
@Property({ type: 'string' })
|
||||
displayName!: string;
|
||||
|
||||
@ManyToMany(() => {
|
||||
return Teacher;
|
||||
})
|
||||
@ManyToMany(() => Teacher)
|
||||
teachers!: Collection<Teacher>;
|
||||
|
||||
@ManyToMany(() => {
|
||||
return Student;
|
||||
})
|
||||
@ManyToMany(() => Student)
|
||||
students!: Collection<Student>;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { TeacherInvitationRepository } from '../../data/classes/teacher-invitati
|
|||
/**
|
||||
* Invitation of a teacher into a class (in order to teach it).
|
||||
*/
|
||||
@Entity({ repository: () => TeacherInvitationRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return TeacherInvitationRepository;
|
||||
|
@ -13,25 +14,19 @@ import { TeacherInvitationRepository } from '../../data/classes/teacher-invitati
|
|||
})
|
||||
export class TeacherInvitation {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
primary: true,
|
||||
})
|
||||
sender!: Teacher;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
primary: true,
|
||||
})
|
||||
receiver!: Teacher;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
entity: () => Class,
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue