This commit is contained in:
parent
7258d283ed
commit
31f5bdc254
42 changed files with 21523 additions and 1040 deletions
45
backend/src/recipes/recipes.controller.ts
Normal file
45
backend/src/recipes/recipes.controller.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue