feat(backend): Assignment-, Group- en SubmissionRepository aangemaakt
This commit is contained in:
parent
bd93e5fae3
commit
2837618fd5
8 changed files with 75 additions and 4 deletions
28
backend/src/entities/assignments/assignment.entity.ts
Normal file
28
backend/src/entities/assignments/assignment.entity.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import {Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Class} from "../classes/class.entity";
|
||||
import {Group} from "./group.entity"
|
||||
import {Language} from "../content/language";
|
||||
|
||||
@Entity()
|
||||
export class Assignment {
|
||||
@ManyToOne({entity: () => Class, primary: true})
|
||||
within!: Class;
|
||||
|
||||
@PrimaryKey({type: "number"})
|
||||
id!: number;
|
||||
|
||||
@Property({type: "string"})
|
||||
title!: string;
|
||||
|
||||
@Property({type: "text"})
|
||||
description!: string;
|
||||
|
||||
@Property({type: "string"})
|
||||
learningPathHruid!: string;
|
||||
|
||||
@Enum({items: () => Language})
|
||||
learningPathLanguage!: Language;
|
||||
|
||||
@OneToMany({entity: () => Group, mappedBy: "assignment"})
|
||||
groups!: Group[];
|
||||
}
|
15
backend/src/entities/assignments/group.entity.ts
Normal file
15
backend/src/entities/assignments/group.entity.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import {Entity, ManyToMany, ManyToOne, PrimaryKey} from "@mikro-orm/core";
|
||||
import {Assignment} from "./assignment.entity";
|
||||
import {Student} from "../users/student.entity";
|
||||
|
||||
@Entity()
|
||||
export class Group {
|
||||
@ManyToOne({entity: () => Assignment, primary: true})
|
||||
assignment!: Assignment;
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
groupNumber!: number;
|
||||
|
||||
@ManyToMany({entity: () => Student})
|
||||
members!: Student[];
|
||||
}
|
31
backend/src/entities/assignments/submission.entity.ts
Normal file
31
backend/src/entities/assignments/submission.entity.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import {Student} from "../users/student.entity";
|
||||
import {Group} from "./group.entity";
|
||||
import {Entity, Enum, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Language} from "../content/language";
|
||||
|
||||
@Entity()
|
||||
export class Submission {
|
||||
@PrimaryKey({type: "string"})
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({items: () => Language, primary: true})
|
||||
learningObjectLanguage!: Language;
|
||||
|
||||
@PrimaryKey({type: "string"})
|
||||
learningObjectVersion: string = "1";
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
submissionNumber!: number;
|
||||
|
||||
@ManyToOne({entity: () => Student})
|
||||
submitter!: Student;
|
||||
|
||||
@Property({type: "datetime"})
|
||||
submissionTime!: Date;
|
||||
|
||||
@ManyToOne({entity: () => Group, nullable: true})
|
||||
onBehalfOf?: Group;
|
||||
|
||||
@Property({type: "json"})
|
||||
content!: string;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue