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

[BE] feat: 회원 탈퇴 시 발생하는 N+1 문제 해결 #943

Merged
merged 7 commits into from
Nov 16, 2023

Conversation

youngh0
Copy link
Collaborator

@youngh0 youngh0 commented Nov 15, 2023

주요 변경사항

  • 기존에 deleteAll() 을 사용하던 회원 탈퇴 로직을 별도의 JPQL 로 작성한 deleteByCustomer() 로 대체했습니다.

리뷰어에게...

  • 회원 탈퇴가 일어나진 않겠지만 그래도 쿼리 개선하고 싶어서 PR 올립니다..!
  • VisitorCancelMembershipAcceptanceTest.이것저것_많이한_회원_탈퇴 기준 28번의 쿼리 -> 5번의 쿼리로 감소했습니다.
  • 기존 엔티티에 모두 @where 가 붙어 있어서 이를 무시하기 위해 JQPL 에 nativeQuery 옵션 설정했습니다.
  • 인수테스트에 탈퇴한 고객의 리워드 같은거 조회해서 빈 배열인지 확인하려고 했는데 이미 탈퇴한 회원으로 조회 요청하면 예외 발생해서 못했습니다. (인증 로직 잘 짰네요 ㅎ)
    • 대신 service 테스트를 통해서 deleteByCustomer() 메서드 호출하는지 검증하는 테스트 추가했습니다.
    • 각각의 repository 단위테스트도 추가했습니다.

관련 이슈

closes

체크리스트

  • reviewers 설정
  • label 설정
  • milestone 설정

@youngh0 youngh0 added 기능구현 ✅ 새로운 기능 추가에 대한 이슈 back-end 👩‍👩‍👦‍👦 백엔드 관련 이슈 labels Nov 15, 2023
@youngh0 youngh0 self-assigned this Nov 15, 2023
Copy link

Unit Test Results

255 tests   255 ✔️  17s ⏱️
104 suites      0 💤
104 files        0

Results for commit 506669e.

Copy link
Collaborator

@gitchannn gitchannn left a comment

Choose a reason for hiding this comment

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

좋은 제안 감사합니다.
제안이 받아들여져서 머지하겠습니다.

@gitchannn gitchannn merged commit 823a3cf into develop Nov 16, 2023
@gitchannn gitchannn deleted the feat/deleteByJpql branch November 16, 2023 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end 👩‍👩‍👦‍👦 백엔드 관련 이슈 기능구현 ✅ 새로운 기능 추가에 대한 이슈
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants