Skip to content

Conversation

@leebs0521
Copy link
Collaborator

resolved :

📌 과제 설명

  • 리뷰 아이디로 상세 조회
  • 특정 유저가 작성한 리뷰 리스트(페이징) 조회
  • 기관에 대한 리뷰 리스트(페이징) 조회
  • 리스트 조회시 봉사 유형을 검색 조건을 넣을 수 있다.

👩‍💻 요구 사항과 구현 내용

✅ PR 포인트 & 궁금한 점

  • queryDsl로 할 수 밖에 없었던 저를 용서해주십쇼..
  • 조인만 사용하고 select는 Review만 가져왔습니다..
  • 아래는 객체로 조립해서 가져오려다가 너무 코드가 이상해서 포기한 흔적입니다..
    private final ReviewRepository reviewRepository;
    private final RecruitBoardQueryUseCase recruitBoardQueryUseCase;
    private final VolunteerApplyQueryUseCase volunteerApplyQueryUseCase;

   @Override
    public Page<ReviewResponseDto> getReviewsByVolunteerId(
            UUID volunteerId,
            ReviewSearchCondition condition
    ) {
        return (condition.volunteerType() == null)
                ? getReviewsByVolunteerIdWithoutType(volunteerId, condition.pageable())
                : getReviewsByVolunteerIdWithType(volunteerId, condition);
    }
    
     private Page<ReviewResponseDto> getReviewsByVolunteerIdWithType(
            UUID volunteerId,
            ReviewSearchCondition condition
    ) {
        List<Long> recruitIds = recruitBoardQueryUseCase.getCompletedIdsByType(
                condition.volunteerType());
        if (recruitIds.isEmpty()) {
            return Page.empty(condition.pageable());
        }

        List<Long> applyIds = volunteerApplyQueryUseCase.getIdsVolunteerIdAndByRecruitIds(
                volunteerId, recruitIds);
        if (applyIds.isEmpty()) {
            return Page.empty(condition.pageable());
        }

        Page<Review> reviews = reviewRepository.findAllByApplyIds(applyIds, condition.pageable());
        return reviews.map(ReviewResponseDto::from);
    }

@leebs0521 leebs0521 self-assigned this Dec 2, 2024
@leebs0521 leebs0521 linked an issue Dec 2, 2024 that may be closed by this pull request
4 tasks
Copy link
Collaborator

@m-a-king m-a-king left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다. 역시 테스트 코드에 진심이시군요.
조인으로 처리하는 것도 확인했습니다!

Copy link
Collaborator

@ayoung-dev ayoung-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2024

@leebs0521 leebs0521 merged commit 5c958ed into main Dec 2, 2024
3 checks passed
@leebs0521 leebs0521 deleted the feature/99-add-review-query branch December 2, 2024 15:05
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.

[FEATURE] 리뷰 조회 기능

5 participants