Skip to content

Commit

Permalink
Merge pull request #88 from lotteon2/fix/product-review
Browse files Browse the repository at this point in the history
fix: 가게 평점 조회 수정 및 상품 조회
  • Loading branch information
JIUNG9 authored Jan 16, 2024
2 parents 6df1224 + 5e92bbf commit f59f9e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,12 @@ public Map<Long, List<Product>> findProductsByProductsGroupByStoreId(List<String

@Override
public Map<Long, Double> findStoreAverageRating() {
AggregationOperation matchReviewsGreaterThanOne =
Aggregation.match(Criteria.where("reviewCount").gt(1));
AggregationOperation groupByStoreId =
Aggregation.group("storeId").avg("averageRating").as("averageRating");
TypedAggregation<Product> aggregation =
Aggregation.newAggregation(Product.class, groupByStoreId);
Aggregation.newAggregation(Product.class, matchReviewsGreaterThanOne, groupByStoreId);

// Execute the aggregation
AggregationResults<AverageResult> aggregate =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}

Expand Down Expand Up @@ -346,10 +346,6 @@ public StoreAverageDto getStoreAverageRating() {

@Override
public List<StockChangeDto> getFlowerAmountGroupByStoreId(ProcessOrderDto processOrderDto) {
processOrderDto
.getProducts()
.keySet()
.forEach(key -> log.info("!!!!!!!!! {}", processOrderDto.getProducts().get(key)));
Map<Long, List<Product>> productsByProductsGroupByStoreId =
productQueryOutPort.findProductsByProductsGroupByStoreId(
new ArrayList<>(processOrderDto.getProducts().keySet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public static List<StockChangeDto> getFlowerAmountOfStore(
@Getter
public enum SortOption {
TOP_SALE("productSaleAmount"),
SALE("productSaleAmount"),
BOTTOM_SALE("productSaleAmount"),
NEW("createdAt"),
OLD("createdAt"),
Expand Down

0 comments on commit f59f9e7

Please sign in to comment.