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

[refactor] 특정 모임 약속 목록 반환 querydsl 변환 #158

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

chaewonni
Copy link
Member

@chaewonni chaewonni commented Feb 3, 2025

Related issue 🛠

Work Description ✏️

기존 약속 조회 로직은 모든 약속을 조회하는 findAllByMeetingId(meetingId)와 사용자가 참여한 약속을 조회하는 findPromiseByUserIdAndMeetingId(userId, meetingId) 두 개의 쿼리를 실행한 후, Java Stream을 활용해 리스트를 필터링하는 방식이었습니다.
이로 인해 불필요한 쿼리가 두 번 실행되는 문제점이 있었습니다.
이를 하나의 쿼리로 수행할 수 있도록 querydsl을 적용했습니다.

  • 특정 모임 약속 목록 반환 API에서 동적으로 바뀌는 (참가자 여부에 따라, 약속 마친 여부에 따라) 부분 querydsl 적용했습니다.
  • 코드도 간결해졌고, 쿼리 수도 줄었습니당
  • 아직 N+1 문제는 일어나지 않지만, 이후 확장을 위해(각 promise의 참가자 데이터 사용할 시) fetchJoin 적용해주었습니다.

Uncompleted Tasks 😅

  • N/A

To Reviewers 📢

@chaewonni chaewonni self-assigned this Feb 3, 2025
@chaewonni chaewonni requested a review from tkdwns414 February 3, 2025 13:45
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.

[refactor] 특정 모임 약속 목록 반환 querydsl 변환
1 participant