Recipe-app main
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
IsArray,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateNested,
|
||||
ArrayMinSize,
|
||||
} from 'class-validator';
|
||||
import { Type } from 'class-transformer';
|
||||
import { CreateRecipeIngredientDto } from './create-recipe-ingredient.dto';
|
||||
|
||||
export class CreateRecipeDto {
|
||||
@IsString()
|
||||
name!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
instructions?: string;
|
||||
|
||||
@IsArray()
|
||||
@ArrayMinSize(1)
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateRecipeIngredientDto)
|
||||
ingredients!: CreateRecipeIngredientDto[];
|
||||
}
|
||||
Reference in New Issue
Block a user