diff --git a/src/modules/cart/cart.repository.ts b/src/modules/cart/cart.repository.ts index 8188712..5db9705 100644 --- a/src/modules/cart/cart.repository.ts +++ b/src/modules/cart/cart.repository.ts @@ -353,6 +353,9 @@ class CartShipItemRepo extends BaseRepository { constructor() { super(CartShipmentItemModel); } + async getCartShipmentItems(cartId: string) { + return this.model.find({ cart: cartId }); + } } function createCartShipItemRepo(): CartShipItemRepo { diff --git a/src/modules/cart/cart.service.ts b/src/modules/cart/cart.service.ts index 6cd1698..c636156 100644 --- a/src/modules/cart/cart.service.ts +++ b/src/modules/cart/cart.service.ts @@ -25,8 +25,9 @@ class CartService { async getCartS(userId: string) { const doc = (await this.cartRepo.getCartWithAggregate(userId))[0] as ICart; const cart = CartDTO.transformCart(doc); + const cartShipmentItems = await this.cartShipItemRepo.getCartShipmentItems(cart._id); const recommended = await this.getRecommendedProducts(doc); - return { cart, recommended }; + return { cart: { ...cart, cartShipmentItems }, recommended }; } async clearCart(userId: string) {