Skip to content
Extraits de code Groupes Projets

Fix/search by client.

Fusionnées anas elhaddad a demandé de fusionner fix/search-by-client vers develop
Comparer et
4 fichiers
+ 35
8
Préférences
Navigateur de fichiers
Comparer les modifications
@@ -2,6 +2,8 @@ package com.marketingconfort.mydressin.mappers;
import com.marketingconfort.mydressin.common.cart.enumurations.ItemCartStatus;
import com.marketingconfort.mydressin.common.cart.models.Cart;
import com.marketingconfort.mydressin.common.cart.models.ItemCart;
import com.marketingconfort.mydressin.common.stockmanagement.enumurations.ProductType;
import com.marketingconfort.mydressin.dtos.CartDTO;
import com.marketingconfort.mydressin.dtos.ClientCartDTO;
import com.marketingconfort.mydressin.services.ExternalApiService;
@@ -11,6 +13,7 @@ import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
@Service
@@ -57,10 +60,14 @@ public class CartMapper {
public ClientCartDTO cartToClientCartDTO(Cart cart)
{
List<ItemCart> itemCarts = cart.getItems()
.stream()
.filter(itemCart -> itemCart.getStatus()!=ItemCartStatus.DELETED_SITE && itemCart.getStatus()!=ItemCartStatus.DELETED_BO )
.toList();
ClientCartDTO clientCartDTO = new ClientCartDTO();
clientCartDTO.setId(cart.getId());
clientCartDTO.setItemsCount(cart.getItemsCount());
clientCartDTO.setSubTotalPrice(cart.getSubTotalPrice());
clientCartDTO.setItemsCount(itemCarts.size());
return clientCartDTO;
}