Skip to content
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

[FIX] 건빵집 작성된 리뷰 조회 API 리팩터링 #149

Merged
merged 6 commits into from
Aug 15, 2023
Merged

Conversation

sung-silver
Copy link
Member

@sung-silver sung-silver commented Aug 15, 2023

🍞 PR 타입

  • 기능 추가
  • 기능 수정
  • 기능 삭제
  • 버그 수정
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트

🍞 반영 브랜치

🍞 변경 사항

  • Mapper 적용하여 리팩토링 진행했습니다
  • 엔티티에는 deliciousKeyword~로 정의되어있는데 ResponseDTO 내에는 taste라고 명시되어 있어 delicious로 통일했습니다
  • 추가로 zeroWaste도 zeroPercent라고 되어있어 zeroWastePercent로 변경했습니다

🍞 테스트 결과

image

🍞 To Reviewer

  • reviewService.java에서 해당 부분 리팩토링을 진행해도 로직이 깔끔한 것 같지 않아 고민입니다 더 좋은 방법이 있을지 궁금합니다
for (Review review : reviewList) {
      List<RecommendKeywordResponseDTO> recommendKeywordList = new ArrayList<>();
      if (review.getIsLike()) {
        List<ReviewRecommendKeyword> reviewRecommendKeywordList =
            reviewRecommendKeywordRepository.findAllByReview(review);
        for (ReviewRecommendKeyword reviewRecommendKeyword : reviewRecommendKeywordList) {
          recommendKeywordList.add(
              RecommendKeywordMapper.INSTANCE.toRecommendKeywordResponseDTO(
                  reviewRecommendKeyword));
        }
      }
      createdAt = review.getCreatedAt().format(DateTimeFormatter.ofPattern("yy.MM.dd"));
      reviewListDto.add(
          ReviewMapper.INSTANCE.toReviewResponseDTO(review, createdAt, recommendKeywordList));
}
  • 또한 Mapper를 사용하여 ReviewListResponseDTO에 percentage 계산값을 넘길 때 Percentage 4개 값을 넘기는게 나을지 이를 한번에 묶는 객체를 하나 더 만드는게 좋을지 고민입니다 조언 부탁드립니다!

@sung-silver sung-silver merged commit 2bed5df into dev Aug 15, 2023
1 check passed
@sung-silver sung-silver deleted the fix/#146 branch February 25, 2024 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FIX] 건빵집 작성된 리뷰 조회 API 리팩터링
2 participants