test: harden business boundary conditions

This commit is contained in:
2026-07-15 00:03:55 +08:00
parent 17a5046ea0
commit b1f35f9d1a
65 changed files with 2311 additions and 293 deletions

View File

@@ -3,7 +3,8 @@ import {
IsString,
IsNotEmpty,
IsInt,
IsDateString,
IsISO8601,
IsMilitaryTime,
Matches,
Min,
Max,
@@ -26,11 +27,11 @@ export class CreateScheduleDto {
@IsNotEmpty()
weekDay: number;
@Matches(/^\d{2}:\d{2}$/)
@IsMilitaryTime()
@IsNotEmpty()
startTime: string;
@Matches(/^\d{2}:\d{2}$/)
@IsMilitaryTime()
@IsNotEmpty()
endTime: string;
@@ -40,11 +41,13 @@ export class CreateScheduleDto {
@Max(1440)
attendanceAdvanceMinutes?: number;
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
@IsNotEmpty()
startDate: string;
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
@IsNotEmpty()
endDate: string;
@@ -87,11 +90,11 @@ export class UpdateScheduleDto {
weekDay?: number;
@IsOptional()
@Matches(/^\d{2}:\d{2}$/)
@IsMilitaryTime()
startTime?: string;
@IsOptional()
@Matches(/^\d{2}:\d{2}$/)
@IsMilitaryTime()
endTime?: string;
@IsOptional()
@@ -101,11 +104,13 @@ export class UpdateScheduleDto {
attendanceAdvanceMinutes?: number;
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
startDate?: string;
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
endDate?: string;
@IsOptional()
@@ -149,21 +154,25 @@ export class QueryScheduleDto {
weekDay?: number;
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
startDate?: string;
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
endDate?: string;
}
export class WeeklyViewQueryDto {
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
startDate?: string;
@IsOptional()
@IsDateString()
@Matches(/^\d{4}-\d{2}-\d{2}$/)
@IsISO8601({ strict: true })
endDate?: string;
@IsOptional()