fix: integratie user + errors gefixt zodat het runt + format
This commit is contained in:
parent
6c4ea0eefb
commit
1b096b411b
55 changed files with 858 additions and 594 deletions
|
@ -11,9 +11,18 @@ import { Group } from './group.entity.js';
|
|||
import { Language } from '../content/language.js';
|
||||
import { AssignmentRepository } from '../../data/assignments/assignment-repository.js';
|
||||
|
||||
@Entity({ repository: () => AssignmentRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return AssignmentRepository;
|
||||
},
|
||||
})
|
||||
export class Assignment {
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
within!: Class;
|
||||
|
||||
@PrimaryKey({ type: 'number' })
|
||||
|
@ -28,9 +37,18 @@ export class Assignment {
|
|||
@Property({ type: 'string' })
|
||||
learningPathHruid!: string;
|
||||
|
||||
@Enum({ items: () => Language })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
})
|
||||
learningPathLanguage!: Language;
|
||||
|
||||
@OneToMany({ entity: () => Group, mappedBy: 'assignment' })
|
||||
@OneToMany({
|
||||
entity: () => {
|
||||
return Group;
|
||||
},
|
||||
mappedBy: 'assignment',
|
||||
})
|
||||
groups!: Group[];
|
||||
}
|
||||
|
|
|
@ -3,14 +3,27 @@ import { Assignment } from './assignment.entity.js';
|
|||
import { Student } from '../users/student.entity.js';
|
||||
import { GroupRepository } from '../../data/assignments/group-repository.js';
|
||||
|
||||
@Entity({ repository: () => GroupRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return GroupRepository;
|
||||
},
|
||||
})
|
||||
export class Group {
|
||||
@ManyToOne({ entity: () => Assignment, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Assignment;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
assignment!: Assignment;
|
||||
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
groupNumber!: number;
|
||||
|
||||
@ManyToMany({ entity: () => Student })
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
})
|
||||
members!: Student[];
|
||||
}
|
||||
|
|
|
@ -4,12 +4,21 @@ import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
|||
import { Language } from '../content/language.js';
|
||||
import { SubmissionRepository } from '../../data/assignments/submission-repository.js';
|
||||
|
||||
@Entity({ repository: () => SubmissionRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return SubmissionRepository;
|
||||
},
|
||||
})
|
||||
export class Submission {
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
learningObjectLanguage!: Language;
|
||||
|
||||
@PrimaryKey({ type: 'string' })
|
||||
|
@ -18,13 +27,22 @@ export class Submission {
|
|||
@PrimaryKey({ type: 'integer' })
|
||||
submissionNumber!: number;
|
||||
|
||||
@ManyToOne({ entity: () => Student })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
})
|
||||
submitter!: Student;
|
||||
|
||||
@Property({ type: 'datetime' })
|
||||
submissionTime!: Date;
|
||||
|
||||
@ManyToOne({ entity: () => Group, nullable: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Group;
|
||||
},
|
||||
nullable: true,
|
||||
})
|
||||
onBehalfOf?: Group;
|
||||
|
||||
@Property({ type: 'json' })
|
||||
|
|
|
@ -3,15 +3,31 @@ 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: () => ClassJoinRequestRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return ClassJoinRequestRepository;
|
||||
},
|
||||
})
|
||||
export class ClassJoinRequest {
|
||||
@ManyToOne({ entity: () => Student, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
requester!: Student;
|
||||
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
|
||||
@Enum(() => ClassJoinRequestStatus)
|
||||
@Enum(() => {
|
||||
return ClassJoinRequestStatus;
|
||||
})
|
||||
status!: ClassJoinRequestStatus;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,11 @@ import { Teacher } from '../users/teacher.entity.js';
|
|||
import { Student } from '../users/student.entity.js';
|
||||
import { ClassRepository } from '../../data/classes/class-repository.js';
|
||||
|
||||
@Entity({ repository: () => ClassRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return ClassRepository;
|
||||
},
|
||||
})
|
||||
export class Class {
|
||||
@PrimaryKey()
|
||||
classId = v4();
|
||||
|
@ -18,9 +22,13 @@ export class Class {
|
|||
@Property({ type: 'string' })
|
||||
displayName!: string;
|
||||
|
||||
@ManyToMany(() => Teacher)
|
||||
@ManyToMany(() => {
|
||||
return Teacher;
|
||||
})
|
||||
teachers!: Collection<Teacher>;
|
||||
|
||||
@ManyToMany(() => Student)
|
||||
@ManyToMany(() => {
|
||||
return Student;
|
||||
})
|
||||
students!: Collection<Student>;
|
||||
}
|
||||
|
|
|
@ -6,14 +6,33 @@ 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;
|
||||
},
|
||||
})
|
||||
export class TeacherInvitation {
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
sender!: Teacher;
|
||||
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
receiver!: Teacher;
|
||||
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
}
|
||||
|
|
|
@ -2,9 +2,18 @@ import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
|||
import { LearningObject } from './learning-object.entity.js';
|
||||
import { AttachmentRepository } from '../../data/content/attachment-repository.js';
|
||||
|
||||
@Entity({ repository: () => AttachmentRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return AttachmentRepository;
|
||||
},
|
||||
})
|
||||
export class Attachment {
|
||||
@ManyToOne({ entity: () => LearningObject, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return LearningObject;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
learningObject!: LearningObject;
|
||||
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
|
|
|
@ -22,18 +22,31 @@ export class ReturnValue {
|
|||
callbackSchema!: string;
|
||||
}
|
||||
|
||||
@Entity({ repository: () => LearningObjectRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return LearningObjectRepository;
|
||||
},
|
||||
})
|
||||
export class LearningObject {
|
||||
@PrimaryKey({ type: 'string' })
|
||||
hruid!: string;
|
||||
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
language!: Language;
|
||||
|
||||
@PrimaryKey({ type: 'string' })
|
||||
version: string = '1';
|
||||
|
||||
@ManyToMany({ entity: () => Teacher })
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
})
|
||||
admins!: Teacher[];
|
||||
|
||||
@Property({ type: 'string' })
|
||||
|
@ -57,7 +70,12 @@ export class LearningObject {
|
|||
@Property({ type: 'array' })
|
||||
skosConcepts!: string[];
|
||||
|
||||
@Embedded({ entity: () => EducationalGoal, array: true })
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return EducationalGoal;
|
||||
},
|
||||
array: true,
|
||||
})
|
||||
educationalGoals: EducationalGoal[] = [];
|
||||
|
||||
@Property({ type: 'string' })
|
||||
|
@ -72,7 +90,11 @@ export class LearningObject {
|
|||
@Property({ type: 'integer' })
|
||||
estimatedTime!: number;
|
||||
|
||||
@Embedded({ entity: () => ReturnValue })
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return ReturnValue;
|
||||
},
|
||||
})
|
||||
returnValue!: ReturnValue;
|
||||
|
||||
@Property({ type: 'bool' })
|
||||
|
@ -81,7 +103,12 @@ export class LearningObject {
|
|||
@Property({ type: 'string', nullable: true })
|
||||
contentLocation?: string;
|
||||
|
||||
@OneToMany({ entity: () => Attachment, mappedBy: 'learningObject' })
|
||||
@OneToMany({
|
||||
entity: () => {
|
||||
return Attachment;
|
||||
},
|
||||
mappedBy: 'learningObject',
|
||||
})
|
||||
attachments: Attachment[] = [];
|
||||
|
||||
@Property({ type: 'blob' })
|
||||
|
|
|
@ -12,15 +12,28 @@ import { Language } from './language.js';
|
|||
import { Teacher } from '../users/teacher.entity.js';
|
||||
import { LearningPathRepository } from '../../data/content/learning-path-repository.js';
|
||||
|
||||
@Entity({ repository: () => LearningPathRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return LearningPathRepository;
|
||||
},
|
||||
})
|
||||
export class LearningPath {
|
||||
@PrimaryKey({ type: 'string' })
|
||||
hruid!: string;
|
||||
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
language!: Language;
|
||||
|
||||
@ManyToMany({ entity: () => Teacher })
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
})
|
||||
admins!: Teacher[];
|
||||
|
||||
@Property({ type: 'string' })
|
||||
|
@ -32,7 +45,12 @@ export class LearningPath {
|
|||
@Property({ type: 'blob' })
|
||||
image!: string;
|
||||
|
||||
@Embedded({ entity: () => LearningPathNode, array: true })
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return LearningPathNode;
|
||||
},
|
||||
array: true,
|
||||
})
|
||||
nodes: LearningPathNode[] = [];
|
||||
}
|
||||
|
||||
|
@ -41,7 +59,11 @@ export class LearningPathNode {
|
|||
@Property({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({ items: () => Language })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
})
|
||||
language!: Language;
|
||||
|
||||
@Property({ type: 'string' })
|
||||
|
@ -53,7 +75,12 @@ export class LearningPathNode {
|
|||
@Property({ type: 'bool' })
|
||||
startNode!: boolean;
|
||||
|
||||
@Embedded({ entity: () => LearningPathTransition, array: true })
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return LearningPathTransition;
|
||||
},
|
||||
array: true,
|
||||
})
|
||||
transitions!: LearningPathTransition[];
|
||||
}
|
||||
|
||||
|
@ -62,6 +89,10 @@ export class LearningPathTransition {
|
|||
@Property({ type: 'string' })
|
||||
condition!: string;
|
||||
|
||||
@OneToOne({ entity: () => LearningPathNode })
|
||||
@OneToOne({
|
||||
entity: () => {
|
||||
return LearningPathNode;
|
||||
},
|
||||
})
|
||||
next!: LearningPathNode;
|
||||
}
|
||||
|
|
|
@ -3,12 +3,26 @@ import { Question } from './question.entity.js';
|
|||
import { Teacher } from '../users/teacher.entity.js';
|
||||
import { AnswerRepository } from '../../data/questions/answer-repository.js';
|
||||
|
||||
@Entity({ repository: () => AnswerRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return AnswerRepository;
|
||||
},
|
||||
})
|
||||
export class Answer {
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
author!: Teacher;
|
||||
|
||||
@ManyToOne({ entity: () => Question, primary: true })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Question;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
toQuestion!: Question;
|
||||
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
|
|
|
@ -3,12 +3,21 @@ import { Language } from '../content/language.js';
|
|||
import { Student } from '../users/student.entity.js';
|
||||
import { QuestionRepository } from '../../data/questions/question-repository.js';
|
||||
|
||||
@Entity({ repository: () => QuestionRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return QuestionRepository;
|
||||
},
|
||||
})
|
||||
export class Question {
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
primary: true,
|
||||
})
|
||||
learningObjectLanguage!: Language;
|
||||
|
||||
@PrimaryKey({ type: 'string' })
|
||||
|
@ -17,7 +26,11 @@ export class Question {
|
|||
@PrimaryKey({ type: 'integer' })
|
||||
sequenceNumber!: number;
|
||||
|
||||
@ManyToOne({ entity: () => Student })
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
})
|
||||
author!: Student;
|
||||
|
||||
@Property({ type: 'datetime' })
|
||||
|
|
|
@ -4,11 +4,19 @@ import { Class } from '../classes/class.entity.js';
|
|||
import { Group } from '../assignments/group.entity.js';
|
||||
import { StudentRepository } from '../../data/users/student-repository.js';
|
||||
|
||||
@Entity({ repository: () => StudentRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return StudentRepository;
|
||||
},
|
||||
})
|
||||
export class Student extends User {
|
||||
@ManyToMany(() => Class)
|
||||
@ManyToMany(() => {
|
||||
return Class;
|
||||
})
|
||||
classes!: Collection<Class>;
|
||||
|
||||
@ManyToMany(() => Group)
|
||||
@ManyToMany(() => {
|
||||
return Group;
|
||||
})
|
||||
groups!: Collection<Group>;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,14 @@ import { User } from './user.entity.js';
|
|||
import { Class } from '../classes/class.entity.js';
|
||||
import { TeacherRepository } from '../../data/users/teacher-repository.js';
|
||||
|
||||
@Entity({ repository: () => TeacherRepository })
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return TeacherRepository;
|
||||
},
|
||||
})
|
||||
export class Teacher extends User {
|
||||
@ManyToMany(() => Class)
|
||||
@ManyToMany(() => {
|
||||
return Class;
|
||||
})
|
||||
classes!: Collection<Class>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue