order list
This commit is contained in:
@@ -22,7 +22,10 @@ export class OrdersController {
|
|||||||
return this.ordersService.create(userId, restaurantId);
|
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() {
|
findAll() {
|
||||||
return this.ordersService.findAll();
|
return this.ordersService.findAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ export class OrdersService {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// await this.cartService.clearCart(userId, restaurantId);
|
// await this.cartService.clearCart(userId, restaurantId);
|
||||||
|
|
||||||
// For offline payment methods (cash on delivery, etc.), order is created and pending
|
// For offline payment methods (cash on delivery, etc.), order is created and pending
|
||||||
// Payment status will be updated when payment is confirmed
|
// Payment status will be updated when payment is confirmed
|
||||||
// TODO: Implement offline payment confirmation flow if needed
|
// TODO: Implement offline payment confirmation flow if needed
|
||||||
@@ -210,8 +209,12 @@ export class OrdersService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
findAll() {
|
async findAll() {
|
||||||
return `This action returns all orders`;
|
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) {
|
findOne(id: number) {
|
||||||
|
|||||||
Reference in New Issue
Block a user