product module
This commit is contained in:
@@ -3,7 +3,7 @@ import { ApiTags, ApiOperation, ApiBearerAuth, ApiParam, ApiHeader, ApiBody } fr
|
||||
import { OrdersService } from '../providers/orders.service';
|
||||
import { AuthGuard } from '../../../auth/guards/auth.guard';
|
||||
import { UserId } from '../../../../common/decorators/user-id.decorator';
|
||||
import { RestId } from 'src/common/decorators/rest-id.decorator';
|
||||
import { ShopId } from 'src/common/decorators/rest-id.decorator';
|
||||
import { AdminAuthGuard } from '../../../auth/guards/adminAuth.guard';
|
||||
import { FindOrdersDto } from '../dto/find-orders.dto';
|
||||
import { OrderStatus } from '../interface/order.interface';
|
||||
@@ -22,7 +22,7 @@ export class OrdersController {
|
||||
@Post('public/checkout')
|
||||
@ApiHeader(API_HEADER_SLUG)
|
||||
@ApiOperation({ summary: 'Checkout : create order and payment record' })
|
||||
checkout(@UserId() userId: string, @RestId() restaurantId: string) {
|
||||
checkout(@UserId() userId: string, @ShopId() restaurantId: string) {
|
||||
return this.ordersService.checkout(userId, restaurantId);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class OrdersController {
|
||||
@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(@ShopId() restId: string, @Query() dto: FindOrdersDto, @UserId() userId: string) {
|
||||
return this.ordersService.findAllForUser(restId, dto, userId);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class OrdersController {
|
||||
@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, @ShopId() restId: string) {
|
||||
return this.ordersService.findOne(orderId, restId);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class OrdersController {
|
||||
@Body() dto: UpdateOrderStatusDto,
|
||||
@Param('id') orderId: string,
|
||||
@Param('status') status: OrderStatus,
|
||||
@RestId() restId: string,
|
||||
@ShopId() 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(@ShopId() restId: string, @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, @ShopId() restId: 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,
|
||||
@ShopId() restId: string,
|
||||
) {
|
||||
return this.ordersService.changeOrderStatus(orderId, restId, status, 'admin', dto?.desc);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export class OrdersController {
|
||||
@Permissions(Permission.VIEW_REPORTS)
|
||||
@ApiOperation({ summary: 'Get Stats for report page' })
|
||||
@Get('admin/orders/stats')
|
||||
findStats(@RestId() restId: string) {
|
||||
findStats(@ShopId() restId: string) {
|
||||
return this.ordersService.getStats(restId);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export class OrdersController {
|
||||
@ApiOperation({ summary: 'Get product sales pie chart data for last month' })
|
||||
@ApiHeader(API_HEADER_SLUG)
|
||||
@Get('admin/orders/product-sales-pie-chart')
|
||||
getFoodSalesPieChart(@RestId() restId: string) {
|
||||
getFoodSalesPieChart(@ShopId() restId: string) {
|
||||
return this.ordersService.getFoodSalesPieChart(restId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user