diff --git a/api-v3/src/inspection-reports/dto/update-deadline-policy.dto.ts b/api-v3/src/inspection-reports/dto/update-deadline-policy.dto.ts new file mode 100644 index 0000000..4407473 --- /dev/null +++ b/api-v3/src/inspection-reports/dto/update-deadline-policy.dto.ts @@ -0,0 +1,48 @@ +import { Transform, Type } from 'class-transformer'; +import { + IsBoolean, + IsDateString, + IsEnum, + IsInt, + IsString, + Max, + MaxLength, + Min, + MinLength, +} from 'class-validator'; +import { InspectionDeadlineDayType } from '../../database/entities'; + +export class UpdateDeadlinePolicyDto { + @Type(() => Number) + @IsInt() + @Min(1) + @Max(365) + urgentDays!: number; + + @IsEnum(InspectionDeadlineDayType) + urgentDayType!: InspectionDeadlineDayType; + + @Type(() => Number) + @IsInt() + @Min(1) + @Max(365) + nonUrgentDays!: number; + + @IsEnum(InspectionDeadlineDayType) + nonUrgentDayType!: InspectionDeadlineDayType; +} + +export class UpsertBusinessCalendarDayDto { + @IsDateString() + date!: string; + + @Transform(({ value }) => value === true || value === 'true') + @IsBoolean() + isBusinessDay!: boolean; + + @Transform(({ value }) => typeof value === 'string' ? value.trim() : value) + @IsString() + @MinLength(1) + @MaxLength(200) + label!: string; +}