feat(backend): Entities toegevoegd

Entites Class, Class Join Request, Class Invitation, Assignment, Group en entities om de Dwengo-leerinhoud te modelleren, toegevoegd.
This commit is contained in:
Gerald Schmittinger 2025-02-23 10:02:19 +01:00
parent 62a278a6e0
commit d5101737ef
14 changed files with 289 additions and 7 deletions

View file

@ -0,0 +1,93 @@
import {Embeddable, Embedded, Entity, Enum, OneToMany, PrimaryKey, Property} from "@mikro-orm/core";
import {Language} from "./language";
import {Attachment} from "./attachment.entity";
@Entity()
export class LearningObject {
@PrimaryKey({type: "string"})
hruid!: string;
@Enum({items: () => Language, primary: true})
language!: Language;
@PrimaryKey({type: "string"})
version: number = "1";
@PrimaryKey({type: "string"})
author!: string;
@Property({type: "string"})
title!: string;
@Property({type: "longtext"})
description!: string;
@Property({type: "string"})
contentType!: string;
@Property({type: "array"})
keywords: string[] = [];
@Property({type: "array", nullable: true})
targetAges?: number[];
@Property({type: "bool"})
teacherExclusive: boolean = false;
@Property({type: "array"})
skosConcepts!: string[];
@Embedded({entity: () => EducationalGoal, array: true})
educationalGoals: EducationalGoal[] = [];
@Property({type: "string"})
copyright: string = ""
@Property({type: "string"})
license: string = ""
@Property({type: "smallint", nullable: true})
difficulty?: number;
@Property({type: "integer"})
estimatedTime!: number;
@Property({type: "bool"})
available: boolean = true;
@Property({type: "string", nullable: true})
contentLocation?: string;
@OneToMany({entity: Attachment})
attachments: Attachment[] = [];
@Property({type: "blob"})
content: Buffer;
}
@Embeddable()
export class EducationalGoal {
@Property({type: "string"})
source: string;
@Property({type: "string"})
id: string;
}
@Embeddable()
export class ReturnValue {
@Property({type: "string"})
callbackUrl: string;
@Property({type: "json"})
callbackSchema: Object;
}
export enum ContentType {
Markdown = "text/markdown",
Image = "image/image",
Mpeg = "audio/mpeg",
Pdf = "application/pdf",
Extern = "extern",
Blockly = "Blockly"
}