test: harden business boundary conditions
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user