fix: shop detail
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
//#######################################
|
||||
|
||||
Reference in New Issue
Block a user