update food

This commit is contained in:
2025-12-16 14:47:15 +03:30
parent 0040acaf2b
commit 8417eef69c
6 changed files with 49 additions and 26 deletions
+21 -1
View File
@@ -1,6 +1,7 @@
import { IsBoolean, IsOptional, IsString, IsNumber, IsArray, IsNotEmpty } from 'class-validator';
import { IsBoolean, IsOptional, IsString, IsNumber, IsArray, IsNotEmpty, IsEnum } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { MealType } from '../interface/food.interface';
export class CreateFoodDto {
@IsNotEmpty()
@@ -54,6 +55,19 @@ export class CreateFoodDto {
@ApiPropertyOptional({ type: [String] })
content?: string[];
@IsOptional()
@IsArray()
@IsNumber({}, { each: true })
@Type(() => Number)
@ApiPropertyOptional({ type: [Number] })
weekDays?: number[];
@IsOptional()
@IsArray()
@IsEnum(MealType, { each: true })
@ApiPropertyOptional({ enum: MealType, isArray: true })
mealTypes?: MealType[];
@IsOptional()
@IsNumber()
@Type(() => Number)
@@ -138,6 +152,12 @@ export class CreateFoodDto {
@ApiPropertyOptional({ example: 0 })
discount?: number;
@IsOptional()
@IsNumber()
@Type(() => Number)
@ApiPropertyOptional({ example: 0 })
score?: number;
@IsOptional()
@IsBoolean()
@ApiPropertyOptional({ example: false })