diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2179125cadc8dafe1381f6acf75dad7ab42297a5..87220ca53e75c7b21a48f2bb5509f8e2e6142945 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+### Added
+- New features that have been added.
+
+### Changed
+- Changes in existing functionality.
+
+### Deprecated
+- Soon-to-be removed features.
+
+### Removed
+- Features that have been removed.
+
+### Fixed
+- fix item count
+
+### Security
+- Any security improvements.
+
## [1.0.70-RELEASE]
### Added
- Added a method to verify cart consistency with the database.
diff --git a/src/main/java/com/marketingconfort/mydressin/services/impl/CartServiceImp.java b/src/main/java/com/marketingconfort/mydressin/services/impl/CartServiceImp.java
index 5e2813fce162fb885b7a3b5a68c317e2b02f4b0b..5f374acc91d00c8318df1f2472cb95edbf0e90c1 100644
--- a/src/main/java/com/marketingconfort/mydressin/services/impl/CartServiceImp.java
+++ b/src/main/java/com/marketingconfort/mydressin/services/impl/CartServiceImp.java
@@ -981,7 +981,7 @@ public class CartServiceImp implements CartService {
throws TechnicalException {
List<ClientDTO> clients = (keyword != null && !keyword.isBlank())
? externalApiService.getClientsByKeyword(keyword)
- : Collections.emptyList();
+ : Collections.emptyList() ;
List<ProductCartDTO> products = (productKeyword != null && !productKeyword.isBlank())
? productStockService.getProductByKeyword(productKeyword)
: Collections.emptyList();
@@ -993,10 +993,10 @@ public class CartServiceImp implements CartService {
.map(ProductCartDTO::getProductId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
- if (clientIds.isEmpty()) {
+ if (clientIds.isEmpty() && keyword == null || keyword.isBlank()) {
clientIds = List.of(-1L);
}
- if (productIds.isEmpty()) {
+ if (productIds.isEmpty() && productKeyword == null || productKeyword.isBlank()) {
productIds = List.of(-1L);
}
Map<Long, ClientDTO> clientMap = clients.stream()
@@ -1041,6 +1041,7 @@ public class CartServiceImp implements CartService {
.mapToDouble(ProductDetailsCartDTO::getTotalPrice)
.sum());
cartDTO.setClientDTO(clientDTO);
+ cartDTO.setItemsCount(productDetailsCartDTOS.size());
cartDTO.setProductDetailsCartDTOS(productDetailsCartDTOS);
return cartDTO;
});