order list
This commit is contained in:
@@ -22,7 +22,10 @@ export class OrdersController {
|
||||
return this.ordersService.create(userId, restaurantId);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@Get('public/orders')
|
||||
@ApiOperation({ summary: 'Get all orders' })
|
||||
@ApiResponse({ status: 200, description: 'Orders fetched successfully' })
|
||||
@ApiResponse({ status: 404, description: 'No orders found' })
|
||||
findAll() {
|
||||
return this.ordersService.findAll();
|
||||
}
|
||||
|
||||
@@ -89,7 +89,6 @@ export class OrdersService {
|
||||
};
|
||||
} else {
|
||||
// await this.cartService.clearCart(userId, restaurantId);
|
||||
|
||||
// For offline payment methods (cash on delivery, etc.), order is created and pending
|
||||
// Payment status will be updated when payment is confirmed
|
||||
// TODO: Implement offline payment confirmation flow if needed
|
||||
@@ -210,8 +209,12 @@ export class OrdersService {
|
||||
};
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return `This action returns all orders`;
|
||||
async findAll() {
|
||||
const orders = await this.em.find(Order, {}, { populate: ['user', 'restaurant', 'address', 'paymentMethod'] });
|
||||
if (!orders) {
|
||||
throw new NotFoundException('No orders found');
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
|
||||
Reference in New Issue
Block a user