chore: add the order count to user porfile

This commit is contained in:
mahyargdz
2025-09-17 15:49:14 +03:30
parent eb7305366c
commit 23a51aceb3
3 changed files with 104 additions and 5 deletions
+2 -2
View File
@@ -333,11 +333,11 @@ class OrderService {
//#######################################################
//#######################################################
async getUserOrders(userId: string, statusQuery: OrderStatusQuery) {
// const orders = await this.orderRepo.model.find({ user: userId });
const docs = await this.orderRepo.getUserOrders(userId, statusQuery);
const orders = docs.map((doc) => UserOrderDTO.transformOrder(doc));
const mappedOrders = orders.map((order) => this.mapUserOrderItems(order));
return { mappedOrders, orders };
const userOrderCount = await this.orderRepo.getUserOrderCount(userId);
return { mappedOrders, orders, userOrderCount };
}
//helper methods