restauarant list in sup
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, UseGuards, Delete } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Patch, Param, UseGuards, Delete, Query } from '@nestjs/common';
|
||||
import { RestaurantsService } from '../providers/restaurants.service';
|
||||
import { CreateRestaurantDto } from '../dto/create-restaurant.dto';
|
||||
import { UpdateRestaurantDto } from '../dto/update-restaurant.dto';
|
||||
import { FindRestaurantsDto } from '../dto/find-restaurants.dto';
|
||||
import { AdminAuthGuard } from 'src/modules/auth/guards/adminAuth.guard';
|
||||
import {
|
||||
ApiBearerAuth,
|
||||
@@ -13,28 +14,24 @@ import {
|
||||
ApiHeader,
|
||||
} from '@nestjs/swagger';
|
||||
import { RestId } from 'src/common/decorators';
|
||||
import { API_HEADER_SLUG } from 'src/common/constants';
|
||||
import { SuperAdminAuthGuard } from 'src/modules/auth/guards/superAdminAuth.guard';
|
||||
|
||||
@ApiTags('restaurants')
|
||||
@Controller()
|
||||
export class RestaurantsController {
|
||||
constructor(private readonly restaurantsService: RestaurantsService) {}
|
||||
constructor(private readonly restaurantsService: RestaurantsService) { }
|
||||
|
||||
@Get('public/restaurants/:slug')
|
||||
@ApiOperation({ summary: 'Get restaurant specification by slug' })
|
||||
@ApiHeader({
|
||||
name: 'X-Slug',
|
||||
required: true,
|
||||
schema: {
|
||||
type: 'string',
|
||||
default: 'zhivan',
|
||||
},
|
||||
})
|
||||
@ApiHeader(API_HEADER_SLUG)
|
||||
@ApiParam({ name: 'slug', required: true, description: 'Restaurant slug' })
|
||||
@ApiNotFoundResponse({ description: 'Restaurant not found' })
|
||||
findBySlug(@Param('slug') slug: string) {
|
||||
return this.restaurantsService.getRestaurantSpecification(slug);
|
||||
}
|
||||
|
||||
/** Admin Endpoints */
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Post('admin/restaurants')
|
||||
@@ -44,13 +41,6 @@ export class RestaurantsController {
|
||||
return this.restaurantsService.create(createRestaurantDto);
|
||||
}
|
||||
|
||||
// @Get('admin/restaurants')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
// @ApiBearerAuth()
|
||||
// @ApiOperation({ summary: 'Get all restaurants' })
|
||||
// findAll() {
|
||||
// return this.restaurantsService.findAll();
|
||||
// }
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@@ -86,4 +76,13 @@ export class RestaurantsController {
|
||||
remove(@Param('id') id: string) {
|
||||
return this.restaurantsService.remove(id);
|
||||
}
|
||||
|
||||
/** Super Admin Endpoints */
|
||||
// @UseGuards(SuperAdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiOperation({ summary: 'Get all restaurants with pagination and filters' })
|
||||
@Get('super-admin/restaurants')
|
||||
findAll(@Query() dto: FindRestaurantsDto) {
|
||||
return this.restaurantsService.findAll(dto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user