Skip to content

Commit 903bc47

Browse files
authored
[Release] v2.0.5 릴리즈
1 parent 8dad280 commit 903bc47

25 files changed

+57
-194
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ out/
4343
/eat-ssu.tar
4444

4545
### env file ###
46-
.env
46+
.env
47+
48+
/src/main/resources/application-local.yml

src/main/java/ssu/eatssu/domain/menu/persistence/QuerydslMealRatingCalculator.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,6 @@ public Double getMainRatingAverage(Long mealId) {
3232
.fetchOne();
3333
}
3434

35-
public Double getTasteRatingAverage(Long mealId) {
36-
List<Long> menuIds = mealMenuQueryRepository.getMenuIds(mealId);
37-
return queryFactory
38-
.select(review.ratings.tasteRating.avg())
39-
.from(review)
40-
.join(review.menu, menu)
41-
.where(
42-
menuIdIn(menuIds)
43-
)
44-
.fetchOne();
45-
}
46-
47-
public Double getAmountRatingAverage(Long mealId) {
48-
List<Long> menuIds = mealMenuQueryRepository.getMenuIds(mealId);
49-
return queryFactory
50-
.select(review.ratings.amountRating.avg())
51-
.from(review)
52-
.join(review.menu, menu)
53-
.where(
54-
menuIdIn(menuIds)
55-
)
56-
.fetchOne();
57-
}
5835

5936
private BooleanExpression menuIdIn(List<Long> menuIds) {
6037
return menuIds != null && !menuIds.isEmpty() ? menu.id.in(menuIds) : null;

src/main/java/ssu/eatssu/domain/menu/persistence/QuerydslMenuRatingCalculator.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,7 @@ public Double getMainRatingAverage(Long menuId) {
2626
.fetchOne();
2727
}
2828

29-
public Double getTasteRatingAverage(Long menuId) {
30-
return queryFactory
31-
.select(review.ratings.tasteRating.avg())
32-
.from(review)
33-
.join(review.menu, menu)
34-
.where(
35-
menuIdEq(menuId)
36-
)
37-
.fetchOne();
38-
}
3929

40-
public Double getAmountRatingAverage(Long menuId) {
41-
return queryFactory
42-
.select(review.ratings.amountRating.avg())
43-
.from(review)
44-
.join(review.menu, menu)
45-
.where(
46-
menuIdEq(menuId)
47-
)
48-
.fetchOne();
49-
}
5030

5131
private BooleanExpression menuIdEq(Long menuId) {
5232
return menu.id.eq(menuId);

src/main/java/ssu/eatssu/domain/partnership/entity/RestaurantType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public enum RestaurantType {
44
RESTAURANT("음식점"),
55
CAFE("카페"),
6-
BEER("주점");
6+
PUB("주점");
77

88
private final String type;
99

src/main/java/ssu/eatssu/domain/rating/entity/JpaLoadCollectionRatingCalculator.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ public RatingAverages mealAverageRatings(Meal meal) {
3434
long totalReviewCount = mealTotalReviewCount(meal);
3535

3636
if (totalReviewCount == 0)
37-
return new RatingAverages(null, null, null);
37+
return new RatingAverages(null);
3838

3939
return RatingAverages.builder()
4040
.mainRating(averageRating(mealTotalMainRating(meal), totalReviewCount))
41-
.amountRating(averageRating(mealTotalAmountRating(meal), totalReviewCount))
42-
.tasteRating(averageRating(mealTotalTasteRating(meal), totalReviewCount))
4341
.build();
4442
}
4543

@@ -48,13 +46,11 @@ public RatingAverages menuAverageRatings(Menu menu) {
4846
int totalReviewCount = menu.getTotalReviewCount();
4947

5048
if (totalReviewCount == 0) {
51-
return new RatingAverages(null, null, null);
49+
return new RatingAverages(null);
5250
}
5351

5452
return RatingAverages.builder()
5553
.mainRating(averageRating(menuTotalMainRating(menu), totalReviewCount))
56-
.amountRating(averageRating(menuTotalAmountRating(menu), totalReviewCount))
57-
.tasteRating(averageRating(menuTotalTasteRating(menu), totalReviewCount))
5854
.build();
5955
}
6056

@@ -101,35 +97,11 @@ public Integer mealTotalMainRating(Meal meal) {
10197
.reduce(null, this::sum);
10298
}
10399

104-
// 식단 양 평점 총합
105-
public Integer mealTotalAmountRating(Meal meal) {
106-
return meal.getMealMenus().stream()
107-
.map(MealMenu::getMenu)
108-
.map(menu -> menu.getReviews().getTotalAmountRating())
109-
.reduce(null, this::sum);
110-
}
111-
112-
// 식단 맛 평점 총합
113-
public Integer mealTotalTasteRating(Meal meal) {
114-
return meal.getMealMenus().stream()
115-
.map(MealMenu::getMenu)
116-
.map(menu -> menu.getReviews().getTotalTasteRating())
117-
.reduce(null, this::sum);
118-
}
119100

120101
// 메뉴 메인 평점 총합
121102
public Integer menuTotalMainRating(Menu menu) {
122103
return menu.getReviews().getTotalMainRating();
123104
}
124105

125-
// 메뉴 양 평점 총합
126-
public Integer menuTotalAmountRating(Menu menu) {
127-
return menu.getReviews().getTotalAmountRating();
128-
}
129-
130-
// 메뉴 맛 평점 총합
131-
public Integer menuTotalTasteRating(Menu menu) {
132-
return menu.getReviews().getTotalTasteRating();
133-
}
134106

135107
}

src/main/java/ssu/eatssu/domain/rating/entity/JpaProjectionRatingCalculator.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,14 @@ public RatingAverages mealAverageRatings(Meal meal) {
4242
long totalReviewCount = mealTotalReviewCount(meal);
4343

4444
if (totalReviewCount == 0)
45-
return new RatingAverages(null, null, null);
45+
return new RatingAverages(null);
4646

4747
Collection<RatingsDto> mealRatings = reviewRepository.findByMenu_MealMenus_Meal(meal, RatingsDto.class);
4848

4949
Integer totalMainRating = mealRatings.stream().mapToInt(RatingsDto::getMainRating).sum();
50-
Integer totalTasteRating = mealRatings.stream().mapToInt(RatingsDto::getTasteRating).sum();
51-
Integer totalAmountRating = mealRatings.stream().mapToInt(RatingsDto::getAmountRating).sum();
5250

5351
return RatingAverages.builder()
5452
.mainRating(averageRating(totalMainRating, totalReviewCount))
55-
.tasteRating(averageRating(totalTasteRating, totalReviewCount))
56-
.amountRating(averageRating(totalAmountRating, totalReviewCount))
5753
.build();
5854
}
5955

src/main/java/ssu/eatssu/domain/rating/entity/Ratings.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,12 @@ public class Ratings {
1212

1313
private Integer mainRating;
1414

15-
private Integer amountRating;
16-
17-
private Integer tasteRating;
18-
19-
private Ratings(Integer mainRating, Integer amountRating, Integer tasteRating) {
15+
private Ratings(Integer mainRating) {
2016
Assert.isTrue(mainRating >= 0 && mainRating <= 5, "mainRating must be between 0 and 5");
21-
Assert.isTrue(amountRating >= 0 && amountRating <= 5, "amountRating must be between 0 and 5");
22-
Assert.isTrue(tasteRating >= 0 && tasteRating <= 5, "tasteRating must be between 0 and 5");
2317
this.mainRating = mainRating;
24-
this.amountRating = amountRating;
25-
this.tasteRating = tasteRating;
2618
}
2719

28-
public static Ratings of(Integer mainRating, Integer amountRating, Integer tasteRating) {
29-
return new Ratings(mainRating, amountRating, tasteRating);
20+
public static Ratings of(Integer mainRating) {
21+
return new Ratings(mainRating);
3022
}
3123
}

src/main/java/ssu/eatssu/domain/review/dto/CreateMenuReviewRequest.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ public class CreateMenuReviewRequest {
2121
private Long menuId;
2222
@Schema(description = "평점-메인", example = "4")
2323
private Integer mainRating;
24-
25-
@Schema(description = "평점-양", example = "4")
26-
private Integer amountRating;
27-
28-
@Schema(description = "평점-맛", example = "4")
29-
private Integer tasteRating;
30-
3124
@Max(150)
3225
@Schema(description = "한줄평", example = "맛있어용")
3326
private String content;
@@ -36,19 +29,8 @@ public class CreateMenuReviewRequest {
3629
private String imageUrl;
3730
private MenuLikeRequest menuLike;
3831

39-
public CreateMenuReviewRequest(int mainRating, int amountRating, int tasteRating, String content) {
40-
Assert.isTrue(mainRating >= 1 && mainRating <= 5, "평점은 1에서 5 사이 여야 합니다.");
41-
Assert.isTrue(amountRating >= 1 && amountRating <= 5, "평점은 1에서 5 사이 여야 합니다.");
42-
Assert.isTrue(tasteRating >= 1 && tasteRating <= 5, "평점은 1에서 5 사이 여야 합니다.");
43-
Assert.notNull(content, "리뷰는 null이 될 수 없습니다.");
44-
this.mainRating = mainRating;
45-
this.amountRating = amountRating;
46-
this.tasteRating = tasteRating;
47-
this.content = content;
48-
}
49-
5032
public Review toReviewEntity(User user, Menu menu) {
51-
Ratings ratings = Ratings.of(this.mainRating, this.amountRating, this.tasteRating);
33+
Ratings ratings = Ratings.of(this.mainRating);
5234
return Review.builder()
5335
.user(user)
5436
.content(this.content)

src/main/java/ssu/eatssu/domain/review/dto/MealReviewsResponse.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public static MealReviewsResponse of(Long totalReviewCount, List<String> menuNam
3737
return MealReviewsResponse.builder()
3838
.menuNames(menuNames)
3939
.mainRating(ratingAverages.mainRating())
40-
.amountRating(ratingAverages.amountRating())
41-
.tasteRating(ratingAverages.tasteRating())
4240
.totalReviewCount(totalReviewCount)
4341
.reviewRatingCount(reviewRatingCount)
4442
.build();

src/main/java/ssu/eatssu/domain/review/dto/MenuLikeRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
public class MenuLikeRequest {
1111
@Schema(description = "메뉴 식별자", example = "123")
1212
private Long menuId;
13-
@Schema(description = "좋아요 or 싫어요", example = "좋아요 : true or 싫어요 : false")
13+
@Schema(description = "좋아요 선택", example = "좋아요 : true (기본값은 false)")
1414
private Boolean isLike;
1515
}

0 commit comments

Comments
 (0)