Merge pull request #30 from Danakcorp/mrtz

add: shipment item to cart
This commit is contained in:
morteza-mortezai
2025-10-28 14:34:42 +03:30
committed by GitHub
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -353,6 +353,9 @@ class CartShipItemRepo extends BaseRepository<ICartShipmentItem> {
constructor() {
super(CartShipmentItemModel);
}
async getCartShipmentItems(cartId: string) {
return this.model.find({ cart: cartId });
}
}
function createCartShipItemRepo(): CartShipItemRepo {
+2 -1
View File
@@ -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) {