feat: add Schedules module with conflict detection and weekly view

This commit is contained in:
2026-07-05 19:21:37 +08:00
parent 78320b8682
commit 037c0e07e0
5 changed files with 432 additions and 0 deletions

View File

@@ -0,0 +1,152 @@
import {
IsOptional,
IsString,
IsNotEmpty,
IsInt,
IsDateString,
Matches,
Min,
Max,
} from 'class-validator';
export class CreateScheduleDto {
@IsInt()
@IsNotEmpty()
classId: number;
@IsInt()
@IsNotEmpty()
classroomId: number;
@IsInt()
@Min(1)
@Max(7)
@IsNotEmpty()
weekDay: number;
@Matches(/^\d{2}:\d{2}$/)
@IsNotEmpty()
startTime: string;
@Matches(/^\d{2}:\d{2}$/)
@IsNotEmpty()
endTime: string;
@IsDateString()
@IsNotEmpty()
startDate: string;
@IsDateString()
@IsNotEmpty()
endDate: string;
@IsString()
@IsNotEmpty()
subject: string;
@IsOptional()
@IsInt()
teacherId?: number;
@IsOptional()
@IsString()
scheduleType?: string;
@IsOptional()
@IsInt()
rentalId?: number;
@IsOptional()
@IsString()
notes?: string;
}
export class UpdateScheduleDto {
@IsOptional()
@IsInt()
classId?: number;
@IsOptional()
@IsInt()
classroomId?: number;
@IsOptional()
@IsInt()
@Min(1)
@Max(7)
weekDay?: number;
@IsOptional()
@Matches(/^\d{2}:\d{2}$/)
startTime?: string;
@IsOptional()
@Matches(/^\d{2}:\d{2}$/)
endTime?: string;
@IsOptional()
@IsDateString()
startDate?: string;
@IsOptional()
@IsDateString()
endDate?: string;
@IsOptional()
@IsString()
subject?: string;
@IsOptional()
@IsInt()
teacherId?: number;
@IsOptional()
@IsString()
scheduleType?: string;
@IsOptional()
@IsInt()
rentalId?: number;
@IsOptional()
@IsString()
notes?: string;
}
export class QueryScheduleDto {
@IsOptional()
@IsInt()
classroomId?: number;
@IsOptional()
@IsInt()
classId?: number;
@IsOptional()
@IsInt()
@Min(1)
@Max(7)
weekDay?: number;
@IsOptional()
@IsDateString()
startDate?: string;
@IsOptional()
@IsDateString()
endDate?: string;
}
export class WeeklyViewQueryDto {
@IsOptional()
@IsDateString()
startDate?: string;
@IsOptional()
@IsDateString()
endDate?: string;
@IsOptional()
@IsInt()
classroomId?: number;
}