add dto validation and swagger schemas
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsISO8601, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
|
||||
|
||||
export class CreateBookingDto {
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
@IsUUID()
|
||||
customerId!: string;
|
||||
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
@IsUUID()
|
||||
businessId!: string;
|
||||
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
@IsUUID()
|
||||
businessServiceId!: string;
|
||||
|
||||
/** ISO 8601 datetime string */
|
||||
@ApiProperty({ example: '2026-05-13T10:00:00.000Z' })
|
||||
@IsISO8601()
|
||||
scheduledAt!: string;
|
||||
|
||||
@ApiPropertyOptional({ example: 'Test booking', nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(500)
|
||||
note?: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user