fix(backend): Foute entity-structuur van leerpaden verbeterd.

Ook testen geschreven voor LearningPathRepository en LearningObjectRepository.
This commit is contained in:
Gerald Schmittinger 2025-03-09 08:50:39 +01:00
parent 4d999c78ba
commit 1417907933
24 changed files with 474 additions and 64 deletions

View file

@ -0,0 +1,37 @@
import {Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property} from "@mikro-orm/core";
import {Language} from "./language";
import {LearningPath} from "./learning-path.entity";
import {LearningPathTransition} from "./learning-path-transition.entity";
@Entity()
export class LearningPathNode {
@ManyToOne({ entity: () => LearningPath, primary: true })
learningPath!: LearningPath;
@PrimaryKey({ type: "numeric", autoincrement: true })
nodeNumber!: number;
@Property({ type: 'string' })
learningObjectHruid!: string;
@Enum({ items: () => Language })
language!: Language;
@Property({ type: 'number' })
version!: number;
@Property({ type: 'text', nullable: true })
instruction?: string;
@Property({ type: 'bool' })
startNode!: boolean;
@OneToMany({ entity: () => LearningPathTransition, mappedBy: "node" })
transitions: LearningPathTransition[] = [];
@Property({ length: 3 })
createdAt: Date = new Date();
@Property({ length: 3, onUpdate: () => new Date() })
updatedAt: Date = new Date();
}