forked from wangziqi/gongxue-base
feat: add Attendance module with batch, summary, calendar, and dingtalk endpoints
This commit is contained in:
52
apps/server/src/entities/attendance-record.entity.ts
Normal file
52
apps/server/src/entities/attendance-record.entity.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at' })
|
||||
updatedAt: Date;
|
||||
}
|
||||
65
apps/server/src/entities/ding-attendance-raw.entity.ts
Normal file
65
apps/server/src/entities/ding-attendance-raw.entity.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
ManyToOne,
|
||||
JoinColumn,
|
||||
Index,
|
||||
} from 'typeorm';
|
||||
import { Student } from './student.entity';
|
||||
|
||||
@Entity('ding_attendance_raw')
|
||||
@Index(['attendanceDate'])
|
||||
@Index(['matchStatus'])
|
||||
export class DingAttendanceRaw {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column({ name: 'ding_user_id', length: 100 })
|
||||
dingUserId: string;
|
||||
|
||||
@Column({ name: 'user_name', length: 100 })
|
||||
userName: string;
|
||||
|
||||
@Column({ name: 'attendance_date', type: 'date' })
|
||||
attendanceDate: string;
|
||||
|
||||
@Column({ name: 'ding_id', length: 100, unique: true })
|
||||
dingId: string;
|
||||
|
||||
@Column({ name: 'check_in_time', type: 'datetime', nullable: true })
|
||||
checkInTime: Date;
|
||||
|
||||
@Column({ name: 'check_out_time', type: 'datetime', nullable: true })
|
||||
checkOutTime: Date;
|
||||
|
||||
@Column({ name: 'attendance_type', length: 20 })
|
||||
attendanceType: string;
|
||||
|
||||
@Column({ name: 'time_result', length: 20 })
|
||||
timeResult: string;
|
||||
|
||||
@Column({ name: 'location_result', length: 20, nullable: true })
|
||||
locationResult: string;
|
||||
|
||||
@Column({ name: 'match_status', length: 20, default: '未处理' })
|
||||
matchStatus: string;
|
||||
|
||||
@Column({ name: 'matched_student_id', type: 'integer', nullable: true })
|
||||
matchedStudentId: number;
|
||||
|
||||
@ManyToOne(() => Student, { onDelete: 'SET NULL', nullable: true })
|
||||
@JoinColumn({ name: 'matched_student_id' })
|
||||
matchedStudent: Student;
|
||||
|
||||
@Column({ name: 'raw_data', type: 'text', nullable: true })
|
||||
rawData: string;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at' })
|
||||
updatedAt: Date;
|
||||
}
|
||||
@@ -17,3 +17,5 @@ export { Class, ClassType, ClassStatus } from './class.entity';
|
||||
export { ClassStudent } from './class-student.entity';
|
||||
export { ClassTeacher, TeacherRoleType } from './class-teacher.entity';
|
||||
export { ClassSchedule, ScheduleType } from './class-schedule.entity';
|
||||
export { AttendanceRecord } from './attendance-record.entity';
|
||||
export { DingAttendanceRaw } from './ding-attendance-raw.entity';
|
||||
|
||||
Reference in New Issue
Block a user