forked from wangziqi/gongxue-base
feat: add exam score management
This commit is contained in:
49
apps/server/src/entities/exam.entity.ts
Normal file
49
apps/server/src/entities/exam.entity.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user