crud product

This commit is contained in:
2026-01-13 18:19:51 +03:30
parent 984b889587
commit 6522acff5f
27 changed files with 333 additions and 1080 deletions
@@ -20,7 +20,7 @@ export class OrdersController {
@UseGuards(AuthGuard)
@Post('public/checkout')
@ApiHeader(API_HEADER_SLUG)
@ApiOperation({ summary: 'Checkout : create order and payment record' })
checkout(@UserId() userId: string, @RestId() restaurantId: string) {
return this.ordersService.checkout(userId, restaurantId);
@@ -28,18 +28,18 @@ export class OrdersController {
@UseGuards(AuthGuard)
@Get('public/orders')
@ApiHeader(API_HEADER_SLUG)
@ApiOperation({ summary: 'Get all orders with pagination and filters' })
findAll(@RestId() restId: string, @Query() dto: FindOrdersDto, @UserId() userId: string) {
findAll(, @Query() dto: FindOrdersDto, @UserId() userId: string) {
return this.ordersService.findAllForUser(restId, dto, userId);
}
@UseGuards(AuthGuard)
@ApiOperation({ summary: 'Get an order By id for User' })
@ApiParam({ name: 'orderId', description: 'Order ID' })
@ApiHeader(API_HEADER_SLUG)
@Get('public/orders/:orderId')
findOne(@Param('orderId') orderId: string, @RestId() restId: string) {
findOne(@Param('orderId') orderId: string,) {
return this.ordersService.findOne(orderId, restId);
}
@@ -50,7 +50,7 @@ export class OrdersController {
description: 'Order status',
enum: OrderStatus,
})
@ApiHeader(API_HEADER_SLUG)
@ApiBody({ type: UpdateOrderStatusDto })
@ApiOperation({ summary: 'Update status of an order By User' })
@ApiParam({ name: 'id', description: 'Order ID' })
@@ -58,7 +58,7 @@ export class OrdersController {
@Body() dto: UpdateOrderStatusDto,
@Param('id') orderId: string,
@Param('status') status: OrderStatus,
@RestId() restId: string,
,
) {
return this.ordersService.changeOrderStatus(orderId, restId, status, 'user', dto?.desc);
}
@@ -68,7 +68,7 @@ export class OrdersController {
@Permissions(Permission.MANAGE_ORDERS)
@Get('admin/orders')
@ApiOperation({ summary: 'Get all orders with pagination and filters' })
findAllAdmin(@RestId() restId: string, @Query() dto: FindOrdersDto) {
findAllAdmin(, @Query() dto: FindOrdersDto) {
return this.ordersService.findAllForAdmin(restId, dto);
}
@@ -77,7 +77,7 @@ export class OrdersController {
@ApiOperation({ summary: 'Get an order By id for User' })
@ApiParam({ name: 'orderId', description: 'Order ID' })
@Get('admin/orders/:orderId')
findOneAsAdmin(@Param('orderId') orderId: string, @RestId() restId: string) {
findOneAsAdmin(@Param('orderId') orderId: string,) {
return this.ordersService.findOne(orderId, restId);
}
@@ -96,7 +96,7 @@ export class OrdersController {
@Param('orderId') orderId: string,
@Body() dto: UpdateOrderStatusDto,
@Param('status') status: OrderStatus,
@RestId() restId: string,
,
) {
return this.ordersService.changeOrderStatus(orderId, restId, status, 'admin', dto?.desc);
}
@@ -105,16 +105,16 @@ export class OrdersController {
@Permissions(Permission.VIEW_REPORTS)
@ApiOperation({ summary: 'Get Stats for report page' })
@Get('admin/orders/stats')
findStats(@RestId() restId: string) {
findStats() {
return this.ordersService.getStats(restId);
}
@UseGuards(AdminAuthGuard)
@Permissions(Permission.VIEW_REPORTS)
@ApiOperation({ summary: 'Get product sales pie chart data for last month' })
@ApiHeader(API_HEADER_SLUG)
@Get('admin/orders/product-sales-pie-chart')
getproductSalesPieChart(@RestId() restId: string) {
getproductSalesPieChart() {
return this.ordersService.getproductSalesPieChart(restId);
}
}