add recorator

This commit is contained in:
2025-11-16 10:07:53 +03:30
parent 64ac2ead36
commit ad4b2e2c89
11 changed files with 119 additions and 47 deletions
@@ -1,4 +1,4 @@
import { IsNumber, IsBoolean, IsOptional, IsString, Min, Max } from 'class-validator';
import { IsNumber, IsBoolean, IsOptional, IsString, Min, Max, Matches } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
@@ -10,12 +10,18 @@ export class CreateScheduleDto {
@Type(() => Number)
weekDay!: number;
@ApiProperty({ example: '08:00', description: 'زمان باز شدن (دقیقه از نیمه شب)' })
@ApiProperty({ example: '08:00', description: 'زمان باز شدن (HH:MM, از ۰۰:۰۰ تا ۲۳:۵۹)' })
@IsString()
@Matches(/^([01]\d|2[0-3]):([0-5]\d)$/, {
message: 'openTime باید در فرمت HH:MM باشد (00:00 تا 23:59)',
})
openTime!: string;
@ApiProperty({ example: '23:00', description: 'زمان بستن (دقیقه از نیمه شب)' })
@ApiProperty({ example: '23:00', description: 'زمان بستن (HH:MM, از ۰۰:۰۰ تا ۲۳:۵۹)' })
@IsString()
@Matches(/^([01]\d|2[0-3]):([0-5]\d)$/, {
message: 'closeTime باید در فرمت HH:MM باشد (00:00 تا 23:59)',
})
closeTime!: string;
@ApiPropertyOptional({ example: true, description: 'آیا این برنامه فعال است؟' })
@@ -23,4 +29,8 @@ export class CreateScheduleDto {
@IsBoolean()
@Type(() => Boolean)
isActive?: boolean;
@ApiProperty({ example: 'rest-ulid-123', description: 'شناسه رستوران' })
@IsString()
restId!: string;
}