Merge pull request #3 from Danakcorp/mrtz

fix: shop detail
This commit is contained in:
morteza-mortezai
2025-09-28 14:44:18 +03:30
committed by GitHub
2 changed files with 13 additions and 2 deletions
+11
View File
@@ -1649,6 +1649,17 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
shop: { $in: shopIds },
},
},
{
$lookup: {
from: "shops",
localField: "shop",
foreignField: "_id",
as: "shop",
},
},
{
$unwind: "$shop",
},
{
$lookup: {
from: "orders",
+2 -2
View File
@@ -408,9 +408,9 @@ class OrderService {
const orderItems = await this.orderItemRepo.model.find({ order: orderId }).lean();
const shopIds = orderItems.map((item) => item.shop._id);
const orderItem = await this.orderItemRepo.model.findOne({ shop: { in: shopIds }, order: order._id });
const orderItem = await this.orderItemRepo.model.findOne({ shop: { $in: shopIds }, order: order._id });
if (!orderItem) throw new BadRequestError(OrderMessage.OrderItemsNotFound);
return { order, orderItem, shopIds };
return { order, shopIds };
}
//#######################################