import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post } from '@nestjs/common'; import { PantryService } from './pantry.service'; import { CreatePantryItemDto } from './dto/create-pantry-item.dto'; import { CurrentUser } from '../auth/decorators/current-user.decorator'; @Controller('pantry') export class PantryController { constructor(private readonly pantryService: PantryService) {} @Get() findAll(@CurrentUser() user: { userId: number }) { return this.pantryService.findAll(user.userId); } @Post() create( @CurrentUser() user: { userId: number }, @Body() body: CreatePantryItemDto, ) { return this.pantryService.create(user.userId, body); } @Delete(':id') remove( @CurrentUser() user: { userId: number }, @Param('id', ParseIntPipe) id: number, ) { return this.pantryService.remove(user.userId, id); } }