From 6938583986dd884ee0cec4ff66db8a4720426c5a Mon Sep 17 00:00:00 2001 From: tutn Date: Mon, 15 Jul 2024 17:29:56 +0700 Subject: [PATCH] Fix conflict --- .../com/axonivy/market/factory/ProductFactory.java | 14 ++++++-------- .../market/repository/ProductRepository.java | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/marketplace-service/src/main/java/com/axonivy/market/factory/ProductFactory.java b/marketplace-service/src/main/java/com/axonivy/market/factory/ProductFactory.java index 7b9ef521..fea77f26 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/factory/ProductFactory.java +++ b/marketplace-service/src/main/java/com/axonivy/market/factory/ProductFactory.java @@ -2,15 +2,11 @@ import static com.axonivy.market.constants.CommonConstants.LOGO_FILE; import static com.axonivy.market.constants.CommonConstants.SLASH; -import static com.axonivy.market.constants.MetaConstants.*; +import static com.axonivy.market.constants.MetaConstants.DEFAULT_VENDOR_NAME; +import static com.axonivy.market.constants.MetaConstants.DEFAULT_VENDOR_URL; +import static com.axonivy.market.constants.MetaConstants.META_FILE; import static org.apache.commons.lang3.StringUtils.EMPTY; -import com.axonivy.market.enums.Language; -import com.axonivy.market.github.util.GitHubUtils; -import com.axonivy.market.model.DisplayValue; -import com.axonivy.market.model.MultilingualismValue; -import org.apache.commons.lang3.BooleanUtils; - import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -19,15 +15,17 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.kohsuke.github.GHContent; +import org.springframework.util.CollectionUtils; import com.axonivy.market.entity.Product; import com.axonivy.market.github.model.Meta; +import com.axonivy.market.github.util.GitHubUtils; +import com.axonivy.market.model.DisplayValue; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.extern.log4j.Log4j2; -import org.springframework.util.CollectionUtils; @Log4j2 @NoArgsConstructor(access = AccessLevel.PRIVATE) diff --git a/marketplace-service/src/main/java/com/axonivy/market/repository/ProductRepository.java b/marketplace-service/src/main/java/com/axonivy/market/repository/ProductRepository.java index d1844256..23972e4b 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/repository/ProductRepository.java +++ b/marketplace-service/src/main/java/com/axonivy/market/repository/ProductRepository.java @@ -20,14 +20,12 @@ public interface ProductRepository extends MongoRepository { Optional findById(String productId); - Optional findById(String productId); + @Query("{'marketDirectory': {$regex : ?0, $options: 'i'}}") + Product findByMarketDirectoryRegex(String search); - @Query("{'marketDirectory': {$regex : ?0, $options: 'i'}}") - Product findByMarketDirectoryRegex(String search); + @Query("{ $and: [ { $or: [ { 'names.?': { $regex: ?0, $options: 'i' } }, { 'shortDescriptions.?': { $regex: ?0, $options: 'i' } } ] }, { 'type': ?1 } ] }") + Page searchByKeywordAndType(String keyword, String type, String language, Pageable unifiedPageabe); - @Query("{ $and: [ { $or: [ { 'names.?': { $regex: ?0, $options: 'i' } }, { 'shortDescriptions.?': { $regex: ?0, $options: 'i' } } ] }, { 'type': ?1 } ] }") - Page searchByKeywordAndType(String keyword, String type, String language, Pageable unifiedPageabe); - - @Query("{ $or: [ { 'names.?1': { $regex: ?0, $options: 'i' } }, { 'shortDescriptions.?1': { $regex: ?0, $options: 'i' } } ] }") - Page searchByNameOrShortDescriptionRegex(String keyword, String language, Pageable unifiedPageabe); + @Query("{ $or: [ { 'names.?1': { $regex: ?0, $options: 'i' } }, { 'shortDescriptions.?1': { $regex: ?0, $options: 'i' } } ] }") + Page searchByNameOrShortDescriptionRegex(String keyword, String language, Pageable unifiedPageabe); }