Skip to content

Conversation

@heeone1
Copy link
Collaborator

@heeone1 heeone1 commented Jan 21, 2026

#️⃣연관된 이슈

📝작업 내용

  • 친구 목록, 신청 한 목록, 신청 받은 목록 조회할 떄 각 친구의 레벨이 같이 조회되도록 수정하였습니다.
  • 친구 추가는 최대 10명만 가능하도록 수정하였습니다.
  • 피그마를 확인했을 때 친구 목록, 나에게 온 신청 목록을 조회에는 총 몇명인지 같이 조회가 되어야 해서 count도 같이 조회되도록 수정하였습니다.

📝 기타 참고사항

@heeone1 heeone1 self-assigned this Jan 21, 2026
Copy link
Member

@nahjjun nahjjun left a comment

Choose a reason for hiding this comment

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

전체적으로 N+1 문제만 해결하면 될 것 같습니다!! 코드 수정하느라 고생하셨습니다!!!

Comment on lines 201 to +204
.findBySenderAndStatus(sender, FriendRequestStatus.PENDING)
.stream()
.map(req -> FriendRequestListResDto.builder()
.requestId(req.getId())
.userId(req.getReceiver().getId())
.nickname(req.getReceiver().getNickname())
.requestedAt(req.getCreatedAt())
.build()
)
.map(req -> {
User receiver = req.getReceiver();
Copy link
Member

Choose a reason for hiding this comment

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

FriendRequestRepository의 findBySenderAndStatus() 함수에서 JPQL로 Fetch Join으로 Receiver도 한번에 가져오는 것이 좋을 것 같습니다.

현재 구조에서는 매 FriendRequest에 연결되어있는 Receiver를 Lazy Loading으로 매번 쿼리문을 가져오기 때문에 n+1 문제가 우려됩니다. 해당 부분 수정해주시면 성능적으로 이점이 있을 것 같습니다!

Comment on lines +224 to +227
List<FriendResDto> friends = friendRepository.findByUser(user)
.stream()
.map(friend -> FriendResDto.builder()
.friendId(friend.getFriend().getId())
.nickname(friend.getFriend().getNickname())
.build()
)
.map(friend -> {
var friendUser = friend.getFriend();
Copy link
Member

Choose a reason for hiding this comment

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

이 부분도 위에서 언급한 것과 마찬가지로, findByUser 함수에서 Friend 엔티티도 Fetch Join으로 가져와야 N+1 문제가 생기지 않을 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Feature: 친구 신청 API 개발

3 participants