creat order bug
This commit is contained in:
@@ -39,18 +39,66 @@ export class productController {
|
||||
) { }
|
||||
|
||||
|
||||
// @Get('public/products/:productId')
|
||||
// @UseGuards()
|
||||
// @ApiBearerAuth()
|
||||
// @ApiOperation({ summary: 'Get a product by id' })
|
||||
// @ApiParam({ name: 'productId', required: true })
|
||||
// findPublicproductById(@Param('productId') productId: string, @UserId() userId?: string): Promise<any> {
|
||||
// const a = this.productsService.findPublicById(productId, userId);
|
||||
// return a;
|
||||
// }
|
||||
/*====================CATEGORY =========================*/
|
||||
@Post('admin/category')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Create a new category' })
|
||||
@ApiBody({ type: CreateCategoryDto })
|
||||
createCategory(@Body() createproductDto: CreateCategoryDto) {
|
||||
return this.categoryService.create(createproductDto);
|
||||
}
|
||||
|
||||
@Get('admin/category')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Get a paginated list of Categories' })
|
||||
@ApiQuery({ name: 'page', required: false, type: Number })
|
||||
@ApiQuery({ name: 'limit', required: false, type: Number })
|
||||
@ApiQuery({ name: 'search', required: false, type: String })
|
||||
@ApiQuery({ name: 'orderBy', required: false, type: String })
|
||||
@ApiQuery({ name: 'order', required: false, enum: ['asc', 'desc'] })
|
||||
@ApiQuery({ name: 'isActive', required: false, type: Boolean })
|
||||
async findAllCategories(@Query() dto: FindCategoriesDto) {
|
||||
const result = await this.categoryService.findAll(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------- Admin ---------------------------------- */
|
||||
@Get('admin/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/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/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);
|
||||
}
|
||||
|
||||
/* =============================== PRODUCT ================================= */
|
||||
@Post('admin/product')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@@ -109,66 +157,9 @@ export class productController {
|
||||
return this.productService.remove(id);
|
||||
}
|
||||
|
||||
/**CATEGORY */
|
||||
@Post('admin/product/category')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Create a new category' })
|
||||
@ApiBody({ type: CreateCategoryDto })
|
||||
createCategory(@Body() createproductDto: CreateCategoryDto) {
|
||||
return this.categoryService.create(createproductDto);
|
||||
}
|
||||
|
||||
|
||||
@Get('admin/products/category')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
@Permissions(Permission.MANAGE_productS)
|
||||
@ApiOperation({ summary: 'Get a paginated list of Categories' })
|
||||
@ApiQuery({ name: 'page', required: false, type: Number })
|
||||
@ApiQuery({ name: 'limit', required: false, type: Number })
|
||||
@ApiQuery({ name: 'search', required: false, type: String })
|
||||
@ApiQuery({ name: 'orderBy', required: false, type: String })
|
||||
@ApiQuery({ name: 'order', required: false, enum: ['asc', 'desc'] })
|
||||
@ApiQuery({ name: 'isActive', required: false, type: Boolean })
|
||||
async findAllCategories(@Query() dto: FindCategoriesDto) {
|
||||
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);
|
||||
}
|
||||
|
||||
/*------------------------------ Attibute ------------------------*/
|
||||
/*=============================== Attibute ==========================*/
|
||||
@Post('admin/product/:id/attribute')
|
||||
// @UseGuards(AdminAuthGuard)
|
||||
@ApiBearerAuth()
|
||||
|
||||
Reference in New Issue
Block a user