restuarant
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Controller, Get, Post, Body, Patch, Param, UseGuards, Delete, NotFoundException } from '@nestjs/common';
|
import { Controller, Get, Post, Body, Patch, Param, UseGuards, Delete } from '@nestjs/common';
|
||||||
import { RestaurantsService } from '../providers/restaurants.service';
|
import { RestaurantsService } from '../providers/restaurants.service';
|
||||||
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
|
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
|
||||||
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
|
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
|
||||||
@@ -37,43 +37,37 @@ export class RestaurantsController {
|
|||||||
return this.restaurantsService.create(createRestaurantDto);
|
return this.restaurantsService.create(createRestaurantDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('admin/restaurants')
|
// @Get('admin/restaurants')
|
||||||
@UseGuards(AdminAuthGuard)
|
// @UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
// @ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'Get all restaurants' })
|
// @ApiOperation({ summary: 'Get all restaurants' })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurants found' })
|
// @ApiResponse({ status: 200, description: 'Restaurants found' })
|
||||||
findAll() {
|
// findAll() {
|
||||||
return this.restaurantsService.findAll();
|
// return this.restaurantsService.findAll();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@ApiBearerAuth('admin/restaurants')
|
@ApiBearerAuth('admin/restaurants')
|
||||||
@ApiOperation({ summary: 'Get restaurant by ID from request' })
|
@ApiOperation({ summary: 'Get restaurant by ID from request' })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant found' })
|
|
||||||
@ApiNotFoundResponse({ description: 'Restaurant not found' })
|
|
||||||
@Get('admin/restaurants/my-restaurant')
|
@Get('admin/restaurants/my-restaurant')
|
||||||
async findOne(@RestId() restId: string) {
|
async findOne(@RestId() restId: string) {
|
||||||
return await this.restaurantsService.findOne(restId);
|
return await this.restaurantsService.findOne(restId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
// @UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
// @ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'Update a restaurant' })
|
// @ApiOperation({ summary: 'Update a restaurant' })
|
||||||
@ApiBody({ type: UpdateRestaurantDto })
|
// @ApiBody({ type: UpdateRestaurantDto })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant updated' })
|
// @Patch('admin/restaurants/:id')
|
||||||
@ApiNotFoundResponse({ type: NotFoundException, description: 'Restaurant not found' })
|
// update(@Param('id') id: string, @Body() updateRestaurantDto: UpdateRestaurantDto) {
|
||||||
@Patch('admin/restaurants/:id')
|
// return this.restaurantsService.update(id, updateRestaurantDto);
|
||||||
update(@Param('id') id: string, @Body() updateRestaurantDto: UpdateRestaurantDto) {
|
// }
|
||||||
return this.restaurantsService.update(id, updateRestaurantDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'Update a restaurant' })
|
@ApiOperation({ summary: 'Update a restaurant' })
|
||||||
@ApiBody({ type: UpdateRestaurantDto })
|
@ApiBody({ type: UpdateRestaurantDto })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant updated' })
|
|
||||||
@ApiNotFoundResponse({ type: NotFoundException, description: 'Restaurant not found' })
|
|
||||||
@Patch('admin/restaurants/my-restaurant')
|
@Patch('admin/restaurants/my-restaurant')
|
||||||
updateMyRestaurant(@RestId() restId: string, @Body() updateRestaurantDto: UpdateRestaurantDto) {
|
updateMyRestaurant(@RestId() restId: string, @Body() updateRestaurantDto: UpdateRestaurantDto) {
|
||||||
return this.restaurantsService.update(restId, updateRestaurantDto);
|
return this.restaurantsService.update(restId, updateRestaurantDto);
|
||||||
@@ -82,8 +76,6 @@ export class RestaurantsController {
|
|||||||
@UseGuards(AdminAuthGuard)
|
@UseGuards(AdminAuthGuard)
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@ApiOperation({ summary: 'Delete a restaurant' })
|
@ApiOperation({ summary: 'Delete a restaurant' })
|
||||||
@ApiResponse({ status: 200, description: 'Restaurant deleted' })
|
|
||||||
@ApiNotFoundResponse({ description: 'Restaurant not found' })
|
|
||||||
@Delete('admin/restaurants/:id')
|
@Delete('admin/restaurants/:id')
|
||||||
remove(@Param('id') id: string) {
|
remove(@Param('id') id: string) {
|
||||||
return this.restaurantsService.remove(id);
|
return this.restaurantsService.remove(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user