auth
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Query, UseGuards } from '@nestjs/common';
|
||||
import { FoodService } from '../providers/food.service';
|
||||
import { CreateFoodDto } from '../dto/create-food.dto';
|
||||
import { UpdateFoodDto } from '../dto/update-food.dto';
|
||||
@@ -14,7 +14,10 @@ import {
|
||||
ApiBody,
|
||||
ApiParam,
|
||||
} from '@nestjs/swagger';
|
||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||
import { RestId } from 'src/common/decorators';
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiTags('foods')
|
||||
@Controller('foods')
|
||||
export class FoodController {
|
||||
@@ -24,8 +27,8 @@ export class FoodController {
|
||||
@ApiOperation({ summary: 'Create a new food' })
|
||||
@ApiCreatedResponse({ description: 'The food has been successfully created.', type: CreateFoodDto })
|
||||
@ApiBody({ type: CreateFoodDto })
|
||||
create(@Body() createFoodDto: CreateFoodDto) {
|
||||
return this.foodsService.create(createFoodDto);
|
||||
create(@Body() createFoodDto: CreateFoodDto, @RestId() restId: string) {
|
||||
return this.foodsService.create(restId, createFoodDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@@ -38,8 +41,8 @@ export class FoodController {
|
||||
@ApiQuery({ name: 'order', required: false, enum: ['asc', 'desc'] })
|
||||
@ApiQuery({ name: 'categoryId', required: false, type: String })
|
||||
@ApiQuery({ name: 'isActive', required: false, type: Boolean })
|
||||
findAll(@Query() dto: FindFoodsDto) {
|
||||
return this.foodsService.findAll(dto);
|
||||
findAll(@Query() dto: FindFoodsDto,@RestId() restId: string) {
|
||||
return this.foodsService.findAll(restId, dto);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
|
||||
Reference in New Issue
Block a user