✨ Feat: 회원 탈퇴 API (소프트 삭제) — DELETE /auth/withdraw - #114
Merged
Conversation
인증된 사용자를 탈퇴(소프트 삭제) 처리한다. 데이터는 보존하되 재로그인·재가입을 차단한다. - UserStatus: WITHDRAWN 추가 - User: withdrawnAt 필드 + withdraw()/isWithdrawn() (suspend 패턴) - V22 마이그레이션: chk_users_status에 WITHDRAWN 추가 + withdrawn_at 컬럼 - AuthService.withdraw(): status 전이 + RT 무효화 + 쿠키 제거(logout 헬퍼 재사용) - findOrCreateOauthUser: WITHDRAWN 계정 재로그인 차단(AUTH_009) - AuthController: DELETE /auth/withdraw (@AuthenticationPrincipal, 인증 필요) - AuthErrorCode: AUTH_009(탈퇴한 계정입니다, 403) - 회귀 테스트 4건 (소프트삭제+세션종료, 멱등, USER_001, 재로그인 차단)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
연결 Issue
closes #
작업 유형
변경 내용
인증된 사용자의 회원 탈퇴 API를 추가한다. 방식은 소프트 삭제(데이터 보존)다.
엔드포인트:
DELETE /auth/withdraw(인증 필요)UserStatus:WITHDRAWN추가User:withdrawnAt필드 +withdraw()/isWithdrawn()(기존suspend()패턴 준수)V22:chk_users_status제약에WITHDRAWN추가 +withdrawn_at컬럼 (develop 최신 V21 다음 번호)AuthService.withdraw():status=WITHDRAWN+withdrawnAt기록 → 리프레시 토큰(Redis) 무효화 +ilkwa_refresh쿠키 제거 (logout헬퍼 재사용). 쿠키 없음/이미 탈퇴여도 멱등.findOrCreateOauthUser: WITHDRAWN 계정 재로그인·재가입 차단(AUTH_009)AuthController/Impl:@DeleteMapping("/withdraw")+@AuthenticationPrincipal UserPrincipalAuthErrorCode:AUTH_009("탈퇴한 계정입니다", 403)설계 메모
usersFK가 전부ON DELETE CASCADE라 하드 삭제 시 과외·제출·노트·코인 등 전부 영구 삭제됨. 복구·정산·재가입 정책 대응을 위해 보존.JwtAuthenticationFilter에서 status 차단을 추가할 수 있음(현재 SUSPENDED도 미차단이라 일관성상 본 PR 범위 제외).테스트 방법
./gradlew test --tests "com.swez.backend.domain.auth.service.AuthServiceTest"status=WITHDRAWN·withdrawnAt기록 + RT 삭제 + 쿠키 제거USER_001AUTH_009./gradlew testBUILD SUCCESSFUL체크리스트
develop브랜치에서 분기했다타입/작업내용)을 따랐다{깃모지} {타입}: {내용}형식을 따른다