forked from wangziqi/gongxue-base
feat: add Schedules module with conflict detection and weekly view
This commit is contained in:
152
apps/server/src/schedules/dto/schedule.dto.ts
Normal file
152
apps/server/src/schedules/dto/schedule.dto.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user