[FIX] 쿼리 타입 정합성을 Long을 값 비교로 수정, 미션 단건 조회시 요청자 이름 추가 - #133
Merged
Conversation
goodjunseon
requested review from
Gimini-3 and
Copilot
and removed request for
Copilot
January 19, 2026 05:34
Gimini-3
approved these changes
Jan 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the mission detail API by adding the requester's nickname to the response and fixes a type mismatch issue in the FamilyRelation JPQL query.
Changes:
- Added
requesterNicknamefield to MissionDetailResponse to provide complete requester information - Fixed JPQL query in FamilyRelationJpaRepository to use
parentId.valuefor proper Long comparison - Added requester member lookup in MissionReadService with appropriate error handling
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| MissionDetailResponse.java | Added requesterNickname field to the response record and factory method |
| MissionReadService.java | Added requester member lookup and passed requester nickname to response; improved code formatting |
| FamilyRelationJpaRepository.java | Fixed JPQL query to compare parentId.value with Long parameter instead of embedded MemberId object |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+135
to
+139
| // 수신자, 요청자 닉네임 조회 | ||
| Member recipient = memberJpaRepository.findById(mission.getRecipientId().getValue()) | ||
| .orElseThrow(() -> BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND)); | ||
| Member requester = memberJpaRepository.findById(mission.getRequesterId().getValue()) | ||
| .orElseThrow(() -> BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND)); |
There was a problem hiding this comment.
Two sequential database calls are made to fetch recipient and requester members separately. Consider optimizing this by fetching both members in a single query using findAllById method, which would reduce the number of database round trips from 2 to 1.
Suggested change
| // 수신자, 요청자 닉네임 조회 | |
| Member recipient = memberJpaRepository.findById(mission.getRecipientId().getValue()) | |
| .orElseThrow(() -> BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND)); | |
| Member requester = memberJpaRepository.findById(mission.getRequesterId().getValue()) | |
| .orElseThrow(() -> BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND)); | |
| // 수신자, 요청자 닉네임 조회 - 두 번의 단건 조회 대신 한 번의 다건 조회 사용 | |
| Long recipientId = mission.getRecipientId().getValue(); | |
| Long requesterId = mission.getRequesterId().getValue(); | |
| List<Member> members = memberJpaRepository.findAllById(Arrays.asList(recipientId, requesterId)); | |
| java.util.Map<Long, Member> memberMap = members.stream() | |
| .collect(Collectors.toMap(member -> member.getId().getValue(), member -> member)); | |
| Member recipient = memberMap.get(recipientId); | |
| if (recipient == null) { | |
| throw BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND); | |
| } | |
| Member requester = memberMap.get(requesterId); | |
| if (requester == null) { | |
| throw BaseException.from(MissionErrorCode.MEMBER_NOT_FOUND); | |
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
1. 한줄 요약 (What / Why)
parentId.value비교로 수정했습니다.2. 리뷰 포인트 (최대 3개)
parentId.value직접 비교가 다른 FamilyRelation 조회 경로와 매핑 일관성을 유지하는지3. 테스트 방법 (간단히)
./gradlew testGET /api/missions/{missionId}(응답에requesterNickname포함 확인)4) 리스크/주의사항 (있으면)
🔗 Relation Issue