51 lines
911 B
TypeScript
51 lines
911 B
TypeScript
import { Type } from 'class-transformer';
|
|
import {
|
|
ArrayMinSize,
|
|
IsArray,
|
|
IsDateString,
|
|
IsNotEmpty,
|
|
IsNumber,
|
|
IsUUID,
|
|
Matches,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { CreateReserveItemDto } from './create-reserve-item.dto';
|
|
|
|
export class CreateReserveDto {
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
salonId: string;
|
|
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
customerId: string;
|
|
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
stylistId: string;
|
|
|
|
@IsDateString()
|
|
appointmentDate: string;
|
|
|
|
@Matches(/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/)
|
|
startTime: string;
|
|
|
|
@Matches(/^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/)
|
|
endTime: string;
|
|
|
|
@IsNumber({ maxDecimalPlaces: 2 })
|
|
@Min(0)
|
|
totalAmount: number;
|
|
|
|
@IsNumber({ maxDecimalPlaces: 2 })
|
|
@Min(0)
|
|
depositAmount: number;
|
|
|
|
@IsArray()
|
|
@ArrayMinSize(1)
|
|
@ValidateNested({ each: true })
|
|
@Type(() => CreateReserveItemDto)
|
|
items: CreateReserveItemDto[];
|
|
}
|