-
Notifications
You must be signed in to change notification settings - Fork 0
[Release] v2.1.4 마이페이지 rating 문제 해결을 위한 배포 #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c88e926
fix: 마이페이지 rating null인 문제 수정 (#325)
JjungminLee 7e7727f
hotfix: 마이페이지 rating null인 문제 수정 (#326)
JjungminLee 94be476
fix: 마이페이지 rating Primitive형 수정 (#327)
JjungminLee fb3b53e
hotfix: rating이 null인 문제 수정
JjungminLee e2f32fa
hotfix: 마이페이지 rating null나오는 문제 수정
JjungminLee ef26c9a
hotfix: findMyReviews 메서드에 Transactional 추가
JjungminLee 3844769
hotfix: queryDSL -> JPA로 영속성 컨텍스트 초기화
JjungminLee a7b3424
hotfix: log추가
JjungminLee 0bccc08
hotfix: legacy rating 로그 추가
JjungminLee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,5 @@ | ||
| package ssu.eatssu.domain.review.service; | ||
|
|
||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_MEAL; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_MENU; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_REVIEW; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.REVIEW_PERMISSION_DENIED; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
| import java.util.stream.Collectors; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.context.ApplicationEventPublisher; | ||
|
|
@@ -27,6 +15,7 @@ | |
| import ssu.eatssu.domain.menu.persistence.MealRepository; | ||
| import ssu.eatssu.domain.menu.persistence.MenuRepository; | ||
| import ssu.eatssu.domain.menu.service.MealRatingService; | ||
| import ssu.eatssu.domain.rating.entity.Ratings; | ||
| import ssu.eatssu.domain.restaurant.entity.Restaurant; | ||
| import ssu.eatssu.domain.review.dto.CreateMealReviewRequest; | ||
| import ssu.eatssu.domain.review.dto.CreateMenuReviewRequestV2; | ||
|
|
@@ -51,6 +40,19 @@ | |
| import ssu.eatssu.global.handler.response.BaseException; | ||
| import ssu.eatssu.global.log.event.LogEvent; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
| import java.util.Optional; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_MEAL; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_MENU; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_REVIEW; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.NOT_FOUND_USER; | ||
| import static ssu.eatssu.global.handler.response.BaseResponseStatus.REVIEW_PERMISSION_DENIED; | ||
|
|
||
| @Slf4j | ||
| @Service | ||
| @RequiredArgsConstructor | ||
|
|
@@ -112,7 +114,6 @@ public void createMenuReview(CustomUserDetails userDetails, CreateMenuReviewRequ | |
| request.getImageUrls().forEach(review::addReviewImage); | ||
| reviewRepository.save(review); | ||
|
|
||
|
|
||
| menu.addReview(review); | ||
|
|
||
| eventPublisher.publishEvent(LogEvent.of( | ||
|
|
@@ -427,6 +428,7 @@ public void deleteReview(CustomUserDetails userDetails, Long reviewId) { | |
| /** | ||
| * 내 리뷰 리스트 조회 | ||
| */ | ||
| @Transactional(readOnly = true) | ||
| public SliceResponse<MyMealReviewResponse> findMyReviews(CustomUserDetails userDetails, Long lastReviewId, | ||
| Pageable pageable) { | ||
| User user = userRepository.findById(userDetails.getId()) | ||
|
|
@@ -435,6 +437,18 @@ public SliceResponse<MyMealReviewResponse> findMyReviews(CustomUserDetails userD | |
| Slice<Review> sliceReviews = reviewRepository.findByUserOrderByIdDesc(user, lastReviewId, | ||
| pageable); | ||
|
|
||
|
|
||
| sliceReviews.forEach(item -> { | ||
| Ratings r = item.getRatings(); | ||
| log.info( | ||
| "reviewId=" + item.getId() | ||
| + ", ratingCol=" + item.getRating() | ||
| + ", ratingsObj=" + (r == null ? "null" : "not-null") | ||
| + ", main=" + (r == null ? null : r.getMainRating()) | ||
| + ", amount=" + (r == null ? null : r.getAmountRating()) | ||
| ); | ||
| }); | ||
|
Comment on lines
+441
to
+450
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| List<MyMealReviewResponse> myMealReviewResponses = sliceReviews.getContent().stream() | ||
| .map(MyMealReviewResponse::from).toList(); | ||
|
|
||
|
|
@@ -445,7 +459,6 @@ public SliceResponse<MyMealReviewResponse> findMyReviews(CustomUserDetails userD | |
| .build(); | ||
| } | ||
|
|
||
|
|
||
| public ValidMenuForViewResponse validMenuForReview(Long mealId) { | ||
| Meal meal = mealRepository.findById(mealId) | ||
| .orElseThrow(() -> new BaseException(NOT_FOUND_MEAL)); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import ssu.eatssu.domain.rating.entity.Ratings; | ||
| import ssu.eatssu.domain.review.dto.MenuIdNameLikeDto; | ||
| import ssu.eatssu.domain.review.entity.Review; | ||
| import ssu.eatssu.domain.review.entity.ReviewMenuLike; | ||
|
|
@@ -20,6 +22,7 @@ | |
| @Builder | ||
| @Schema(title = "리뷰 상세 - 내 리뷰 리스트 조회 용") | ||
| @Getter | ||
| @Slf4j | ||
| public class MyMealReviewResponse { | ||
| @Schema(description = "리뷰 식별자", example = "123") | ||
| Long reviewId; | ||
|
|
@@ -82,10 +85,25 @@ public static MyMealReviewResponse from(Review review) { | |
| ); | ||
| } | ||
|
|
||
| log.info("ratings = {}", review.getRatings()); | ||
| if (review.getRatings() != null) { | ||
| log.info("mainRating = {}", review.getRatings().getMainRating()); | ||
| } | ||
| log.info("legacy rating = {}", review.getRating()); | ||
|
Comment on lines
+88
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| Ratings ratings = review.getRatings(); | ||
| Integer rating = null; | ||
|
|
||
| if (ratings != null && ratings.getMainRating() != null) { | ||
| rating = ratings.getMainRating(); | ||
| } else if (review.getRating() != null) { | ||
| rating = review.getRating(); | ||
| } | ||
|
|
||
| return MyMealReviewResponse | ||
| .builder() | ||
| .reviewId(review.getId()) | ||
| .rating(review.getRating()) | ||
| .rating(rating) | ||
| .writtenAt(review.getCreatedDate().toLocalDate()) | ||
| .content(review.getContent()) | ||
| .imageUrls(imgUrlList) | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
새로 추가된
findMyReviews메소드가 코드 내에서 사용되지 않고 있습니다. 불필요한 코드는 혼란을 야기하고 유지보수성을 떨어뜨릴 수 있으므로, 사용되지 않는다면 제거하는 것이 좋습니다.