pos-be/src/modules/booking-online/order/infrastructure/dto/reschedule.dto.ts

48 lines
1.2 KiB
TypeScript

import { IsString, Matches } from 'class-validator';
import { RescheduleRequest } from 'src/modules/booking-online/order/domain/entities/reschedule-verification.entity';
import { ApiProperty } from '@nestjs/swagger';
export class RescheduleRequestDTO implements RescheduleRequest {
@ApiProperty({
type: String,
required: true,
example: '123e4567-e89b-12d3-a456-426614174000',
description: 'The unique identifier of the booking',
})
@IsString()
booking_id: string;
@ApiProperty({
type: String,
required: true,
example: '25-12-2024',
description: 'The new date for rescheduling in the format DD-MM-YYYY',
})
@IsString()
@Matches(/^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-\d{4}$/, {
message: 'reschedule_date must be in the format DD-MM-YYYY',
})
reschedule_date: string;
}
export class RescheduleVerificationOTP {
@ApiProperty({
type: String,
required: true,
example: '123e4567-e89b-12d3-a456-426614174000',
description: 'The unique identifier of the booking',
})
@IsString()
booking_id: string;
@ApiProperty({
type: String,
required: true,
example: '123456',
description: 'The OTP code sent for verification',
})
@IsString()
code: string;
}