49 lines
962 B
TypeScript
49 lines
962 B
TypeScript
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;
|
|
}
|