2025SELab2-project-Dwengo/backend/src/entities/questions/answer.entity.ts
2025-03-06 13:37:39 +00:00

27 lines
613 B
TypeScript

import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
import { Question } from './question.entity.js';
import { Teacher } from '../users/teacher.entity.js';
@Entity()
export class Answer {
@ManyToOne({
entity: () => Teacher,
primary: true,
})
author!: Teacher;
@ManyToOne({
entity: () => Question,
primary: true,
})
toQuestion!: Question;
@PrimaryKey({ type: 'integer' })
sequenceNumber!: number;
@Property({ type: 'datetime' })
timestamp: Date = new Date();
@Property({ type: 'text' })
content!: string;
}