feat(backend): Question + Answer entities toegevoegd; kleine verbeteringen.
This commit is contained in:
parent
cdfe48d8c5
commit
2657e49ad6
6 changed files with 79 additions and 19 deletions
19
backend/src/entities/questions/answer.entity.ts
Normal file
19
backend/src/entities/questions/answer.entity.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue