import { Controller, Get, Post, Body, Patch, Param, Delete, } from '@nestjs/common'; import { RecipesService } from './recipes.service'; import type { CreateRecipeDto } from './create-recipe.dto'; @Controller('recipe') export class RecipesController { constructor(private readonly recipeService: RecipesService) {} @Post() create(@Body() createRecipeDto: CreateRecipeDto) { return this.recipeService.create(createRecipeDto); } @Get() findAll() { return this.recipeService.findAll(); } @Get(':id') findOne(@Param('id') id: string) { return this.recipeService.findOne(+id); } @Patch(':id') update(@Param('id') id: string, @Body() updateRecipeDto: CreateRecipeDto) { return this.recipeService.update(+id, updateRecipeDto); } @Patch(':id/stars') setStars(@Param('id') id: string, @Body('stars') stars: number) { return this.recipeService.setStars(+id, stars); } @Delete(':id') remove(@Param('id') id: string) { return this.recipeService.remove(+id); } }