feat(backend): Question + Answer entities toegevoegd; kleine verbeteringen.

This commit is contained in:
Gerald Schmittinger 2025-02-23 16:48:06 +01:00
parent cdfe48d8c5
commit 2657e49ad6
6 changed files with 79 additions and 19 deletions

View file

@ -0,0 +1,19 @@
import {Entity, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
import {Question} from "./question.entity";
import {Teacher} from "../users/teacher.entity";
@Entity()
export class Answer {
@ManyToOne({entity: () => Teacher, primary: true})
author!: Teacher;
@ManyToOne({entity: () => Question, primary: true})
toQuestion!: Question;
@PrimaryKey({type: "datetime"})
timestamp: Date;
@Property({type: "text"})
content: string;
}