add dto validation and swagger schemas
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsBoolean, IsInt, IsNumber, IsOptional, IsUUID, Max, Min } from 'class-validator';
|
||||
|
||||
export class CreateBusinessServiceDto {
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
@IsUUID()
|
||||
businessId!: string;
|
||||
|
||||
@ApiProperty({ format: 'uuid' })
|
||||
@IsUUID()
|
||||
serviceTemplateId!: string;
|
||||
|
||||
/** قیمت به واحد پول (عدد اعشاری مجاز است) */
|
||||
@ApiProperty({ example: 100000 })
|
||||
@IsNumber({ maxDecimalPlaces: 2 })
|
||||
@Min(0)
|
||||
price!: number;
|
||||
|
||||
/** اگر خالی باشد از template.defaultDurationMinutes استفاده میشود */
|
||||
@ApiPropertyOptional({ example: 30, nullable: true })
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(1440)
|
||||
durationMinutes?: number | null;
|
||||
|
||||
@ApiPropertyOptional({ example: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user