Conversation
WalkthroughThis change migrates the matching candidate query logic from a JPQL-based approach to a QueryDSL-based custom repository implementation. It introduces new interfaces and classes for QueryDSL integration, updates service and test layers to use the new methods, and adds required build and configuration changes for QueryDSL support. Changes
Sequence Diagram(s)sequenceDiagram
participant Service as MatchingServiceImpl
participant Repo as MatchingRepository (with Custom)
participant Impl as MatchingRepositoryImpl
participant DB as Database
Service->>Repo: findExcludeIds(applicantId)
Repo->>Impl: findExcludeIds(applicantId)
Impl->>DB: Query completed matchings for applicantId
Impl-->>Repo: List<Long> (excludedIds)
Repo-->>Service: List<Long> (excludedIds)
Service->>Repo: findMatchingCandidatesDsl(applicantId, typeResult, gender, festivalId, pageable, excludedIds)
Repo->>Impl: findMatchingCandidatesDsl(...)
Impl->>DB: Query for candidates with filters and exclusions
Impl-->>Repo: List<Participant>
Repo-->>Service: List<Participant>
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Test Results46 tests 46 ✅ 1s ⏱️ Results for commit 66a3a39. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (3)
build.gradle (1)
71-78: Consider usingsourceSets.main.java.srcDirs += file("…")instead of redefining the whole blockRedefining
srcDir 'src/main/java'manually makes the build file harder to scan and can break IDE auto-import helpers if the convention ever changes. A minimal additive approach keeps intent clear:sourceSets.main.java.srcDirs += 'build/generated/sources/annotationProcessor/java/main'Not blocking, but simplifies maintenance.
src/main/java/org/festimate/team/domain/matching/service/impl/MatchingServiceImpl.java (1)
93-105: Reuse immutable objects inside the loop
PageRequest.of(0, 1)is rebuilt on every iteration even though it’s constant. Extracting it once clarifies intent and avoids needless object creation (micro-optimisation but free and readable):+ PageRequest singleCandidate = PageRequest.of(0, 1); for (TypeResult priorityType : priorities) { Optional<Participant> candidate = matchingRepository.findMatchingCandidatesDsl( participant.getParticipantId(), priorityType, myGender, festivalId, - PageRequest.of(0, 1), + singleCandidate, excludedIds ).stream().findFirst();src/main/java/org/festimate/team/domain/matching/repository/MatchingRepository.java (1)
3-8: Remove unused imports.
TypeResult(l.5) andPageable(l.7) are no longer referenced; keep the file clean to avoid compiler warnings.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
build.gradle(2 hunks)src/main/java/org/festimate/team/domain/matching/repository/MatchingRepository.java(1 hunks)src/main/java/org/festimate/team/domain/matching/repository/MatchingRepositoryCustom.java(1 hunks)src/main/java/org/festimate/team/domain/matching/repository/MatchingRepositoryImpl.java(1 hunks)src/main/java/org/festimate/team/domain/matching/service/impl/MatchingServiceImpl.java(1 hunks)src/main/java/org/festimate/team/infra/config/QuerydslConfig.java(1 hunks)src/test/java/org/festimate/team/domain/matching/service/impl/MatchingServiceImplTest.java(7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: test
🔇 Additional comments (4)
src/main/java/org/festimate/team/domain/matching/service/impl/MatchingServiceImpl.java (1)
93-105: Verify that passing the applicant’s gender matches repository semantics
findMatchingCandidatesDslreceivesGender gender.
Here you forward the applicant’s own gender (myGender).
Double-check that the repository interprets this parameter as “exclude same gender” rather than “include only same gender”; otherwise candidates of the wrong gender may be returned or filtered out.If the repository expects the opposite gender, invert before calling:
Gender targetGender = myGender == Gender.MAN ? Gender.WOMAN : Gender.MAN;Marking for verification.
src/main/java/org/festimate/team/domain/matching/repository/MatchingRepositoryCustom.java (1)
10-21: Interface looks goodClear separation of custom operations; names are self-descriptive.
src/main/java/org/festimate/team/domain/matching/repository/MatchingRepository.java (1)
15-15: Good split of responsibilities.Delegating complex candidate-search logic to
MatchingRepositoryCustomkeeps this interface focused on coreMatchingqueries.src/main/java/org/festimate/team/domain/matching/repository/MatchingRepositoryImpl.java (1)
47-63: ```shell
#!/bin/bash
set -eLocate Participant entity
participant_file=$(fd Participant.java | head -n1)
echo "Participant file: $participant_file"
grep -R "private.*Matching" -n "$participant_file" || echo "No direct Matching references found in Participant."Locate Matching entity
matching_file=$(fd Matching.java | head -n1)
echo "Matching file: $matching_file"
grep -R "private.*Participant" -n "$matching_file" || echo "No direct Participant references found in Matching."
grep -R "status" -n "$matching_file" || echo "No status field found in Matching."Inspect repository for Q-class usage
repo_file=$(fd MatchingRepositoryImpl.java | head -n1)
echo "Repository file: $repo_file"
grep -R "QParticipant" -n "$repo_file" || echo "No QParticipant instantiation found."
grep -R "QMatching" -n "$repo_file" || echo "No QMatching instantiation found."</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
📌 PR 제목
[feat] #145 매칭 후보 조회 로직에 QueryDSL 도입 및 최적화
📌 PR 내용
QueryDSL도입: 기존JPQL문자열 기반 쿼리를QueryDSL메서드 체이닝으로 전환하여 동적 필터링, 조건 조합 편의성 확보findBestCandidateByPriority호출 시 매번 실행되던이미 매칭된 대상 조회서브쿼리를 서비스 레벨에서 한 번만 실행하도록 변경해 불필요한 DB 호출을 절감🛠 작업 내용
🔍 관련 이슈
Closes #145
📸 스크린샷 (Optional)
📚 레퍼런스 (Optional)
https://reprisal.tistory.com/178
https://adjh54.tistory.com/484
Summary by CodeRabbit
New Features
Chores
Bug Fixes
Tests