forked from wangziqi/gongxue-base
162 lines
2.2 KiB
TypeScript
162 lines
2.2 KiB
TypeScript
import {
|
|
IsOptional,
|
|
IsString,
|
|
IsNotEmpty,
|
|
IsInt,
|
|
IsDateString,
|
|
Matches,
|
|
Min,
|
|
Max,
|
|
MaxLength,
|
|
} from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
|
|
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()
|
|
@MaxLength(500)
|
|
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()
|
|
@MaxLength(500)
|
|
notes?: string;
|
|
}
|
|
|
|
export class QueryScheduleDto {
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
classroomId?: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
classId?: number;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@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()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
classroomId?: number;
|
|
}
|