forked from wangziqi/gongxue-base
- Create AttendancePage with filter bar, table, calendar view toggle, batch add modal - Register /attendance route with PermissionRoute (attendance:view) - Add menu item in MainLayout with CheckCircleOutlined icon - Add GET /attendance-records with pagination and filters - Add GET /attendance-records/classes for class dropdown - Add source column to AttendanceRecord entity (default: manual) - Frontend tsc --noEmit: clean; backend: only pre-existing test errors
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
Index,
|
|
} from 'typeorm';
|
|
import { Student } from './student.entity';
|
|
import { Class } from './class.entity';
|
|
|
|
@Entity('attendance_records')
|
|
@Index(['classId', 'attendanceDate'])
|
|
@Index(['studentId', 'attendanceDate'])
|
|
export class AttendanceRecord {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ name: 'student_id', type: 'integer' })
|
|
studentId: number;
|
|
|
|
@ManyToOne(() => Student, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'student_id' })
|
|
student: Student;
|
|
|
|
@Column({ name: 'class_id', type: 'integer', nullable: true })
|
|
classId: number;
|
|
|
|
@ManyToOne(() => Class, { onDelete: 'SET NULL', nullable: true })
|
|
@JoinColumn({ name: 'class_id' })
|
|
class: Class;
|
|
|
|
@Column({ name: 'attendance_date', type: 'date' })
|
|
attendanceDate: string;
|
|
|
|
@Column({ length: 20 })
|
|
session: string;
|
|
|
|
@Column({ length: 20 })
|
|
status: string;
|
|
|
|
@Column({ length: 200, nullable: true })
|
|
remark: string;
|
|
|
|
@Column({ name: 'source', length: 20, default: 'manual' })
|
|
source: string;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at' })
|
|
updatedAt: Date;
|
|
}
|