bug
This commit is contained in:
@@ -19,35 +19,30 @@ import { RestId } from 'src/common/decorators';
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@ApiTags('categories')
|
||||
@Controller()
|
||||
@ApiTags('admin/categories')
|
||||
@Controller('admin/categories')
|
||||
export class CategoryController {
|
||||
constructor(private readonly categoryService: CategoryService) {}
|
||||
|
||||
@ApiBearerAuth('/admin/categories')
|
||||
@Post()
|
||||
@ApiOperation({ summary: 'Create category' })
|
||||
@ApiCreatedResponse({ description: 'Category created', type: CreateCategoryDto })
|
||||
@ApiBody({ type: CreateCategoryDto })
|
||||
@Post()
|
||||
create(@Body() dto: CreateCategoryDto) {
|
||||
return this.categoryService.create(dto);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth('/admin/categories')
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'my restaurant categories' })
|
||||
@ApiOkResponse({ description: 'List of categories' })
|
||||
@ApiQuery({ name: 'restId', required: false, type: String })
|
||||
@ApiQuery({ name: 'isActive', required: false, type: Boolean })
|
||||
@Get()
|
||||
findAll(@RestId() restId: string, @Query('isActive') isActive?: string) {
|
||||
// convert isActive from query string to boolean when provided
|
||||
const isActiveBool: boolean | undefined = typeof isActive !== 'undefined' ? isActive === 'true' : undefined;
|
||||
return this.categoryService.findAll({ restId, isActive: isActiveBool });
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth('/admin/categories')
|
||||
@Get(':id')
|
||||
@ApiOperation({ summary: 'Get category' })
|
||||
@ApiOkResponse({ description: 'Category detail', type: CreateCategoryDto })
|
||||
@@ -56,8 +51,6 @@ export class CategoryController {
|
||||
return this.categoryService.findOne(restId, id);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth('/admin/categories')
|
||||
@Patch(':id')
|
||||
@ApiOperation({ summary: 'Update category' })
|
||||
@ApiParam({ name: 'id' })
|
||||
@@ -67,8 +60,6 @@ export class CategoryController {
|
||||
return this.categoryService.update(restId, id, dto);
|
||||
}
|
||||
|
||||
@UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth('/admin/categories')
|
||||
@Delete(':id')
|
||||
@ApiOperation({ summary: 'Delete category' })
|
||||
@ApiParam({ name: 'id' })
|
||||
@@ -77,11 +68,11 @@ export class CategoryController {
|
||||
return this.categoryService.remove(restId, id);
|
||||
}
|
||||
|
||||
@Get('restaurant/:restId')
|
||||
@ApiOperation({ summary: 'Restaurant categories for user' })
|
||||
@ApiOkResponse({ description: 'List of categories' })
|
||||
@ApiParam({ name: 'restId', required: true, type: String })
|
||||
findAllForRestaurant(@Param('restId') restId: string) {
|
||||
return this.categoryService.findRestaurantCategories(restId);
|
||||
}
|
||||
// @Get('restaurant/:restId')
|
||||
// @ApiOperation({ summary: 'Restaurant categories for user' })
|
||||
// @ApiOkResponse({ description: 'List of categories' })
|
||||
// @ApiParam({ name: 'restId', required: true, type: String })
|
||||
// findAllForRestaurant(@Param('restId') restId: string) {
|
||||
// return this.categoryService.findRestaurantCategories(restId);
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user