diff --git a/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java b/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java index 86b0e5e..bfa1a16 100644 --- a/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java +++ b/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java @@ -237,10 +237,12 @@ public Map> findProductsByProductsGroupByStoreId(List findStoreAverageRating() { + AggregationOperation matchReviewsGreaterThanOne = + Aggregation.match(Criteria.where("reviewCount").gt(1)); AggregationOperation groupByStoreId = Aggregation.group("storeId").avg("averageRating").as("averageRating"); TypedAggregation aggregation = - Aggregation.newAggregation(Product.class, groupByStoreId); + Aggregation.newAggregation(Product.class, matchReviewsGreaterThanOne, groupByStoreId); // Execute the aggregation AggregationResults aggregate = diff --git a/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java b/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java index 4bb33f0..bf31891 100644 --- a/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java +++ b/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java @@ -89,7 +89,7 @@ private static Pageable getPageable(Pageable pageable, ProductCommand.SortOption return PageRequest.of( pageable.getPageNumber(), pageable.getPageSize(), - Sort.by(Direction.DESC, "product_sale_status") + Sort.by(Direction.DESC, "productSaleStatus") .and(Sort.by(direction, sortOption.getSortOption()))); } @@ -346,10 +346,6 @@ public StoreAverageDto getStoreAverageRating() { @Override public List getFlowerAmountGroupByStoreId(ProcessOrderDto processOrderDto) { - processOrderDto - .getProducts() - .keySet() - .forEach(key -> log.info("!!!!!!!!! {}", processOrderDto.getProducts().get(key))); Map> productsByProductsGroupByStoreId = productQueryOutPort.findProductsByProductsGroupByStoreId( new ArrayList<>(processOrderDto.getProducts().keySet())); diff --git a/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java b/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java index 38961c6..c8c09de 100644 --- a/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java +++ b/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java @@ -166,6 +166,7 @@ public static List getFlowerAmountOfStore( @Getter public enum SortOption { TOP_SALE("productSaleAmount"), + SALE("productSaleAmount"), BOTTOM_SALE("productSaleAmount"), NEW("createdAt"), OLD("createdAt"),