Skip to content

[OT-253][FEAT]: JPQL사용에 따른 영속성 컨텍스트 오류 수정#144

Merged
marulog merged 4 commits intodevelopfrom
OT-253-feat/delete-account
Mar 10, 2026
Merged

[OT-253][FEAT]: JPQL사용에 따른 영속성 컨텍스트 오류 수정#144
marulog merged 4 commits intodevelopfrom
OT-253-feat/delete-account

Conversation

@marulog
Copy link
Copy Markdown
Collaborator

@marulog marulog commented Mar 10, 2026

📝 작업 내용

이번 PR에서 작업한 내용을 적어주세요

  • 온보딩 화면에서 선호 태그 선택 시 JPQL사용으로 영속성 컨텍스트가 clear되어 onboarding_completed 컬럼이 commit 안되는 오류를 해결했습니다.

JPQL문에 clearAutomatically = true를 지워서 clear 안되도록 수정

  • 회원 탈퇴 시 JPQL사용으로 영속성 컨텍스트가 초기화되어 실제 멤버에 대한 update문이 안나가는 오류를 해결했습니다.

도메인 내부에서 상태를 변경하는게 아닌 레포지토리에서 상태를 변경하도록 수정했습니다.
단점으로는 엔티티 내부 상태의 책임이 레포지토리로 이전되어 추후 쿼리를 수정해야된다는 단점이 존재하지만
명시적으로 DB를 업데이트할 수 있는 장점이 있어서 해당 방법으로 변경했습니다.

📷 스크린샷

☑️ 체크 리스트

체크 리스트를 확인해주세요

  • 테스트는 잘 통과했나요?
  • 충돌을 해결했나요?
  • 이슈는 등록했나요?
  • 라벨은 등록했나요?

#️⃣ 연관된 이슈

close #140

💬 리뷰 요구사항

Summary by CodeRabbit

릴리스 노트

  • Bug Fixes

    • 기존 회원의 카카오 프로필 자동 갱신 및 자동 재활성화 로직 제거
  • Refactor

    • 회원 탈퇴 흐름을 일괄 소프트삭제 방식으로 전환하여 관련 데이터 일괄 처리로 단순화
    • 북마크·좋아요 수 직접 감소 로직 제거
    • 회원 관련 공개 재활성화·탈퇴 메서드 제거 및 저장소 기반 소프트삭제 추가
    • 선호 태그 삭제 동작의 영속성 컨텍스트 처리 방식 변경

@marulog marulog self-assigned this Mar 10, 2026
@marulog marulog added feat 새로운 기능 구현 fix 버그 수정 labels Mar 10, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 10, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ae341a1e-8fde-41df-9168-00fe075b5e2c

📥 Commits

Reviewing files that changed from the base of the PR and between f07bc8c and d6d8b89.

📒 Files selected for processing (1)
  • modules/domain/src/main/java/com/ott/domain/member/domain/Member.java

Walkthrough

Kakao 기존 사용자의 프로필 업데이트 및 reactivation 로직을 제거하고, 회원 탈퇴 경로를 개별 감소 연산에서 JPQL 기반 벌크 소프트 삭제로 대체하며 관련 리포지토 메서드와 Member 엔티티의 일부 public 메서드를 제거/추가했습니다.

Changes

Cohort / File(s) Summary
회원 탈퇴 서비스 변경
apps/api-user/src/main/java/com/ott/api_user/member/service/MemberService.java, modules/domain/src/main/java/com/ott/domain/member/domain/Member.java, modules/domain/src/main/java/com/ott/domain/member/repository/MemberRepository.java
withdraw 흐름을 개별 엔티티 카운트 감소 호출에서 JPQL 기반 벌크 소프트 삭제(softDeleteByMemberId)로 전환. Member의 public 메서드 withdraw, reactivate, updateKakaoProfile 제거 및 MemberRepository에 softDeleteByMemberId 추가.
Kakao 인증 기존회원 처리
apps/api-user/src/main/java/com/ott/api_user/auth/service/KakaoAuthService.java
findOrCreateMember의 기존 회원 분기에서 reactivate()updateKakaoProfile(...) 호출을 제거하고 reactivateRadarPreference(existingMember)만 호출하도록 변경.
북마크·좋아요 카운트 감소 메서드 제거
modules/domain/src/main/java/com/ott/domain/bookmark/repository/BookmarkRepository.java, modules/domain/src/main/java/com/ott/domain/likes/repository/LikesRepository.java
회원 탈퇴 시 사용하던 media 카운트 감소용 메서드(decreaseBookmarkCountByMemberId, decreaseLikesCountByMemberId) 제거; softDeleteAllByMemberId 등은 유지.
영속성 컨텍스트 어노테이션 변경
modules/domain/src/main/java/com/ott/domain/preferred_tag/repository/PreferredTagRepository.java
deleteAllByMember@Modifying(clearAutomatically = true, flushAutomatically = true)를 단순 @Modifying으로 변경하여 자동 clear/flush 동작 제거.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant MemberService as MemberService
    participant BookmarkRepo as BookmarkRepository
    participant LikesRepo as LikesRepository
    participant PreferredTagRepo as PreferredTagRepository
    participant MemberRepo as MemberRepository
    Client->>MemberService: 회원 탈퇴 요청(with memberId)
    MemberService->>BookmarkRepo: softDeleteAllByMemberId(memberId)
    MemberService->>LikesRepo: softDeleteAllByMemberId(memberId)
    MemberService->>PreferredTagRepo: deleteAllByMember(member)
    MemberService->>MemberRepo: softDeleteByMemberId(memberId)
    MemberRepo-->>MemberService: 성공 응답
    MemberService-->>Client: 탈퇴 완료 응답
Loading
sequenceDiagram
    participant Client
    participant KakaoAuth as KakaoAuthService
    participant MemberRepo as MemberRepository
    participant RadarPrefService as RadarPreferenceService
    Client->>KakaoAuth: 카카오 로그인/회원 조회 요청
    KakaoAuth->>MemberRepo: findByProviderId(...)
    alt 기존 회원
        KakaoAuth->>RadarPrefService: reactivateRadarPreference(existingMember)
        KakaoAuth-->>Client: existingMember 반환 (프로필/재활성화 미적용)
    else 신규 회원
        KakaoAuth->>MemberRepo: save(newMember)
        KakaoAuth-->>Client: newMember 반환
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • phonil
  • yubin012
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing persistence context errors related to JPQL usage, which aligns with the core objective of addressing clearAutomatically issues.
Linked Issues check ✅ Passed The PR successfully implements the linked issue #140 requirement to initialize providerId on account deletion, enabling users to register as new users after account withdrawal.
Out of Scope Changes check ✅ Passed Changes to PreferredTagRepository annotation and method removals from Member/Repository classes are within scope for persistence context fixes; all changes support the core objective.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OT-253-feat/delete-account

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@marulog marulog requested a review from phonil March 10, 2026 07:38
Copy link
Copy Markdown
Contributor

@phonil phonil left a comment

Choose a reason for hiding this comment

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

고생했어요~!~!

@marulog marulog merged commit 9ca2210 into develop Mar 10, 2026
@phonil phonil deleted the OT-253-feat/delete-account branch April 4, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 새로운 기능 구현 fix 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OT-253] [FEAT]: 회원 탈퇴 시 신규 유저로 회원가입

2 participants