Merge pull request #32 from Danakcorp/mrtz

fix : cart 500 err
This commit is contained in:
morteza-mortezai
2025-10-28 15:29:04 +03:30
committed by GitHub
+5 -1
View File
@@ -24,8 +24,12 @@ class CartService {
async getCartS(userId: string) {
const doc = (await this.cartRepo.getCartWithAggregate(userId))[0] as ICart;
if (!doc) {
throw new BadRequestError(CartMessage.CartNotFound);
}
const cart = CartDTO.transformCart(doc);
const cartShipmentItems = await this.cartShipItemRepo.getCartShipmentItems(cart._id);
const cartShipmentItems = await this.cartShipItemRepo.getCartShipmentItems(doc._id.toString());
const recommended = await this.getRecommendedProducts(doc);
return { cart: { ...cart, cartShipmentItems }, recommended };
}