category
This commit is contained in:
@@ -20,6 +20,7 @@ import { Permissions } from 'src/common/decorators/permissions.decorator';
|
||||
import { CreateCategoryDto } from '../dto/create-category.dto';
|
||||
import { CategoryService } from '../providers/category.service';
|
||||
import { FindCategoriesDto } from '../dto/find-categories.dto';
|
||||
import { UpdateCategoryDto } from '../dto/update-category.dto';
|
||||
|
||||
@ApiTags('products')
|
||||
@Controller()
|
||||
@@ -126,4 +127,36 @@ export class productController {
|
||||
const result = await this.categoryService.findAll(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Get('admin/products/category/:id')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Get a category by id' })
|
||||
@ApiParam({ name: 'id', required: true })
|
||||
findCategoryById(@Param('id') id: string) {
|
||||
return this.categoryService.findById(+id);
|
||||
}
|
||||
|
||||
@Patch('admin/products/category/:id')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Update a category' })
|
||||
@ApiParam({ name: 'id', required: true })
|
||||
@ApiBody({ type: UpdateCategoryDto })
|
||||
updateCategory(@Param('id') id: string, @Body() dto: UpdateCategoryDto) {
|
||||
return this.categoryService.update(+id, dto);
|
||||
}
|
||||
|
||||
@Delete('admin/products/category/:id')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Delete (soft) a category' })
|
||||
@ApiParam({ name: 'id', required: true })
|
||||
removeCategory(@Param('id') id: string,) {
|
||||
return this.categoryService.remove(+id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user