order list

This commit is contained in:
2025-12-01 22:58:56 +03:30
parent 288b0529cd
commit 1165167619
2 changed files with 10 additions and 4 deletions
+4 -1
View File
@@ -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();
} }
+6 -3
View File
@@ -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) {