Files
gongxue-base/apps/server/src/entities/exam.entity.ts
xiong cbc04fea4f
Some checks failed
CI 检查 / lint (pull_request) Has been cancelled
CI 检查 / typecheck (pull_request) Has been cancelled
CI 检查 / test (pull_request) Has been cancelled
feat: add exam score management
2026-07-21 16:04:17 +08:00

50 lines
1020 B
TypeScript

import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { Class } from './class.entity';
import { ExamScore } from './exam-score.entity';
@Entity('exams')
export class Exam {
@PrimaryGeneratedColumn()
id: number;
@Column({ name: 'exam_type', length: 50 })
examType: string;
@Column({ name: 'exam_name', length: 100 })
examName: string;
@Column({ length: 50 })
subject: string;
@Column({ name: 'exam_date', type: 'date' })
examDate: string;
@Column({ name: 'class_id', type: 'integer' })
classId: number;
@ManyToOne(() => Class)
@JoinColumn({ name: 'class_id' })
class: Class;
@OneToMany(() => ExamScore, (score) => score.exam)
scores: ExamScore[];
@Column({ type: 'varchar', length: 20, default: 'active' })
status: 'active' | 'archived';
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
@UpdateDateColumn({ name: 'updated_at' })
updatedAt: Date;
}