Skip to content

fix: 회원 탈퇴 시 Orders FK 제약 위반 오류 수정 - #230

Merged
kisusu115 merged 1 commit into
mainfrom
fix/member-withdraw-orders-fk
Mar 9, 2026
Merged

kisusu115 merged 1 commit into
mainfrom
fix/member-withdraw-orders-fk

Conversation

@kisusu115

@kisusu115 kisusu115 commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Desc

  • 문제 상황: 회원 탈퇴 API 오류 발생
  • Order 엔티티가 Member에 의존하여 Member Hard delete 시 오류가 발생하던 문제 해결
  • Member 엔티티 내부에 Order 리스트를 유지하는 것은 Member가 비대해지는 것 같아 명시적 선행 삭제로 진행하였습니다.

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 회원 탈퇴 시 관련된 모든 주문 기록이 올바르게 삭제되도록 개선되어 데이터 일관성을 보장합니다.

@github-actions github-actions Bot added the bug Something isn't working label Mar 9, 2026
@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

주문 저장소에 deleteByMemberId(Integer) 메서드를 추가하여 회원 삭제 전에 관련 주문을 먼저 제거하는 기능을 구현했습니다. MemberService의 탈퇴 흐름에 정리 단계를 통합했고, 기존 메서드는 수정되지 않았습니다.

Changes

Cohort / File(s) Summary
Repository Enhancement
src/main/java/com/example/medicare_call/repository/OrderRepository.java
Added deleteByMemberId(Integer memberId) method to enable deletion of orders scoped by member ID, leveraging Spring Data JPA for implementation.
Service Integration
src/main/java/com/example/medicare_call/service/MemberService.java
Injected OrderRepository dependency and integrated deleteByMemberId() call into withdraw flow to clean up related orders before member deletion, compensating for missing ON DELETE CASCADE constraint.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • feat: 회원 탈퇴 api #221: Introduced the withdraw implementation in MemberService that now includes this order cleanup logic as a pre-deletion step.

Suggested reviewers

  • sudo-Terry

Poem

주문 정리하고 회원 지우고 🗑️
외래키 제약 없어도 괜찮아
깔끔하게 연결을 끊어
데이터의 조화로움을 지키네 ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경 사항의 핵심을 정확하게 반영하고 있습니다. Orders FK 제약 위반 오류 수정이라는 주요 목표가 명확하게 표현되어 있습니다.

✏️ 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 fix/member-withdraw-orders-fk

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@kisusu115
kisusu115 requested review from jyun-KIM and sudo-Terry and removed request for jyun-KIM March 9, 2026 07:40
@kisusu115
kisusu115 merged commit ef4de85 into main Mar 9, 2026
3 of 4 checks passed
@kisusu115
kisusu115 deleted the fix/member-withdraw-orders-fk branch March 9, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant