single food

This commit is contained in:
2025-12-14 12:19:19 +03:30
parent 2f21791e23
commit 996cd0016c
2 changed files with 10 additions and 2 deletions
@@ -1,4 +1,4 @@
import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'; import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { CategoryService } from '../providers/category.service'; import { CategoryService } from '../providers/category.service';
import { CreateCategoryDto } from '../dto/create-category.dto'; import { CreateCategoryDto } from '../dto/create-category.dto';
import { UpdateCategoryDto } from '../dto/update-category.dto'; import { UpdateCategoryDto } from '../dto/update-category.dto';
@@ -10,7 +10,6 @@ import {
ApiNotFoundResponse, ApiNotFoundResponse,
ApiParam, ApiParam,
ApiBody, ApiBody,
ApiQuery,
ApiBearerAuth, ApiBearerAuth,
ApiHeader, ApiHeader,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
@@ -39,6 +39,15 @@ export class FoodController {
return this.foodsService.findAllByRestaurant(slug); return this.foodsService.findAllByRestaurant(slug);
} }
@Get('public/foods/:foodId')
@ApiOperation({ summary: 'Get a food by id' })
@ApiParam({ name: 'foodId', required: true })
@ApiOkResponse({ description: 'The food', type: CreateFoodDto })
@ApiNotFoundResponse({ description: 'Food not found' })
findPublicFoodById(@Param('foodId') foodId: string) {
return this.foodsService.findById(foodId);
}
@UseGuards(AdminAuthGuard) @UseGuards(AdminAuthGuard)
@ApiBearerAuth() @ApiBearerAuth()
@Post('admin/foods') @Post('admin/foods')