Add CreateRecipePage component for recipe creation with ingredients. Updated UX

This commit is contained in:
Nils-Johan Gynther
2026-04-09 22:53:52 +02:00
parent 3e38cb5f98
commit 898ac2ef19
7 changed files with 293 additions and 23 deletions
+19 -1
View File
@@ -4,9 +4,27 @@ import {
IsString,
ValidateNested,
ArrayMinSize,
IsInt,
IsNumber,
Min,
} from 'class-validator';
import { Type } from 'class-transformer';
import { CreateRecipeIngredientDto } from './create-recipe-ingredient.dto';
class CreateRecipeIngredientDto {
@IsInt()
productId!: number;
@IsNumber()
@Min(0.01)
quantity!: number;
@IsString()
unit!: string;
@IsOptional()
@IsString()
note?: string;
}
export class CreateRecipeDto {
@IsString()
+3 -3
View File
@@ -1,6 +1,6 @@
import { Body, Controller, Get, Param, ParseIntPipe, Post } from '@nestjs/common';
import { CreateRecipeDto } from './dto/create-recipe.dto';
import { RecipesService } from './recipes.service';
import { CreateRecipeDto } from './dto/create-recipe.dto';
@Controller('recipes')
export class RecipesController {
@@ -22,7 +22,7 @@ export class RecipesController {
}
@Post()
create(@Body() body: CreateRecipeDto) {
return this.recipesService.create(body);
async create(@Body() createRecipeDto: CreateRecipeDto) {
return this.recipesService.create(createRecipeDto);
}
}