mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-26 01:19:40 +00:00
44 lines
964 B
TypeScript
44 lines
964 B
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import {
|
|
IsDate,
|
|
IsNotEmpty,
|
|
IsString,
|
|
IsUUID,
|
|
Matches,
|
|
MinDate,
|
|
} from 'class-validator';
|
|
|
|
export class CreateBookingDto {
|
|
@ApiProperty({
|
|
type: 'string',
|
|
example: '4fa85f64-5717-4562-b3fc-2c963f66afa7',
|
|
})
|
|
@IsNotEmpty()
|
|
@IsUUID('4', { message: 'Invalid space UUID provided' })
|
|
spaceUuid: string;
|
|
|
|
@ApiProperty({
|
|
type: Date,
|
|
})
|
|
@IsNotEmpty()
|
|
@IsDate()
|
|
@MinDate(new Date())
|
|
date: Date;
|
|
|
|
@ApiProperty({ example: '09:00' })
|
|
@IsString()
|
|
@IsNotEmpty({ message: 'Start time cannot be empty' })
|
|
@Matches(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, {
|
|
message: 'Start time must be in HH:mm format (24-hour)',
|
|
})
|
|
startTime: string;
|
|
|
|
@ApiProperty({ example: '17:00' })
|
|
@IsString()
|
|
@IsNotEmpty({ message: 'End time cannot be empty' })
|
|
@Matches(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/, {
|
|
message: 'End time must be in HH:mm format (24-hour)',
|
|
})
|
|
endTime: string;
|
|
}
|