forked from wangziqi/gongxue-base
- Delete department.entity.ts, user-department.entity.ts - Remove Department/UserDepartment from entities/index.ts - Remove departmentId column from 18 entities (AttendanceRecord, ArchiveAttachment, Bill, ClassSchedule, Classroom, ClassroomRental, Deposit, DepositInstallment, ExamScore, LearningRecord, Occupancy, PersonalExpense, ResultArchive, Room, RoomExpense, Student, StudentEnrollment, StudentProfile, StudentReport) - Remove departments/ module entirely - Delete campus-scope.ts, campus-scope.middleware.ts (request-utils.ts kept — it's just IP extraction) - Simplify common.module.ts to empty module - Remove CampusScopeMiddleware from app.module.ts - Remove all CampusScope injections and filter calls across all services - Remove departmentId from all DTOs and controllers - Simplify dingtalk/wecom sync to only sync users (no dept table) - Update seed module to remove department seeding - Clean frontend compilation
84 lines
1.9 KiB
TypeScript
84 lines
1.9 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
Check,
|
|
} from 'typeorm';
|
|
|
|
export enum ScheduleType {
|
|
INTERNAL = 'INTERNAL',
|
|
RENTAL = 'RENTAL',
|
|
}
|
|
|
|
@Entity('class_schedule')
|
|
@Check('week_day BETWEEN 1 AND 7')
|
|
export class ClassSchedule {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ name: 'class_id', type: 'integer', nullable: true })
|
|
classId: number | null;
|
|
|
|
// Forward reference — Class entity
|
|
@ManyToOne('Class', { nullable: true })
|
|
@JoinColumn({ name: 'class_id' })
|
|
class: unknown;
|
|
|
|
@Column({ name: 'classroom_id', type: 'integer' })
|
|
classroomId: number;
|
|
|
|
// Forward reference — Classroom entity
|
|
@ManyToOne('Classroom')
|
|
@JoinColumn({ name: 'classroom_id' })
|
|
classroom: unknown;
|
|
|
|
@Column({ name: 'week_day', type: 'integer' })
|
|
weekDay: number;
|
|
|
|
@Column({ name: 'start_time', length: 5 })
|
|
startTime: string;
|
|
|
|
@Column({ name: 'end_time', length: 5 })
|
|
endTime: string;
|
|
|
|
@Column({ name: 'start_date', type: 'date' })
|
|
startDate: string;
|
|
|
|
@Column({ name: 'end_date', type: 'date' })
|
|
endDate: string;
|
|
|
|
@Column({ name: 'subject', length: 50 })
|
|
subject: string;
|
|
|
|
@Column({ name: 'teacher_id', type: 'integer', nullable: true })
|
|
teacherId: number | null;
|
|
|
|
// Forward reference — User entity
|
|
@ManyToOne('User', { nullable: true })
|
|
@JoinColumn({ name: 'teacher_id' })
|
|
teacher: unknown;
|
|
|
|
@Column({ name: 'schedule_type', length: 20, default: 'INTERNAL' })
|
|
scheduleType: string;
|
|
|
|
@Column({ name: 'rental_id', type: 'integer', nullable: true })
|
|
rentalId: number | null;
|
|
|
|
@Column({ name: 'status', length: 20, default: 'active' })
|
|
status: string;
|
|
|
|
@Column({ name: 'notes', type: 'text', nullable: true })
|
|
notes: string;
|
|
|
|
@CreateDateColumn({ name: 'created_at' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ name: 'updated_at' })
|
|
updatedAt: Date;
|
|
|
|
}
|