add dto validation and swagger schemas

This commit is contained in:
2026-05-12 16:17:39 +03:30
parent abb387e743
commit 460537090b
21 changed files with 510 additions and 0 deletions
@@ -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;
}
@@ -1,7 +1,21 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsISO8601, IsOptional, IsString, MaxLength } from 'class-validator';
import { BookingStatus } from '../../../entities/booking.entity';
export class UpdateBookingDto {
@ApiPropertyOptional({ example: '2026-05-13T10:00:00.000Z' })
@IsOptional()
@IsISO8601()
scheduledAt?: string;
@ApiPropertyOptional({ enum: BookingStatus, example: BookingStatus.CONFIRMED })
@IsOptional()
@IsEnum(BookingStatus)
status?: BookingStatus;
@ApiPropertyOptional({ example: 'Customer asked for morning slot', nullable: true })
@IsOptional()
@IsString()
@MaxLength(500)
note?: string | null;
}