Skip to content

feat: #258 회원탈퇴 기능#271

Merged
FLYLIKEB merged 2 commits intomainfrom
feature/issue-258-withdraw
Mar 16, 2026
Merged

feat: #258 회원탈퇴 기능#271
FLYLIKEB merged 2 commits intomainfrom
feature/issue-258-withdraw

Conversation

@FLYLIKEB
Copy link
Copy Markdown
Owner

@FLYLIKEB FLYLIKEB commented Mar 16, 2026

Summary

  • Closes [Feature] 회원탈퇴 기능 #258
  • 이메일 계정: 비밀번호 확인 후 탈퇴
  • OAuth 전용 계정: "탈퇴합니다" 텍스트 확인 후 탈퇴
  • 탈퇴 시 사용자의 노트, 관련 데이터 모두 삭제
  • 탈퇴 후 쿠키 초기화 및 로그인 페이지로 이동

Changes

Backend

  • DELETE /auth/withdraw 엔드포인트 추가 (JWT 인증 필요)
  • WithdrawDto: 이메일 계정은 password, OAuth 전용은 confirmText 사용
  • 탈퇴 시 노트 먼저 삭제 후 트랜잭션으로 User 삭제 (admin 패턴과 동일)
  • AuthModuleNotesModule 추가

Frontend

  • authApi.withdraw() API 클라이언트 추가
  • Settings 페이지에 회원탈퇴 버튼 및 확인 모달 추가
  • 이메일 계정: 비밀번호 입력 필드
  • OAuth 전용: "탈퇴합니다" 텍스트 입력 필드

Test plan

  • npm run build (frontend) — pass
  • npm run build (backend, auth files) — pass
  • Settings 컴포넌트 테스트 22개 pass
  • cd backend && npm run test:e2e — pre-existing @adminjs/typeorm module resolution issue blocks E2E (unrelated to this PR)

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 설정 페이지에서 회원탈퇴 옵션 추가
    • 계정 삭제 시 관련 사용자 데이터 및 콘텐츠 자동 정리
    • 이메일 인증 사용자는 비밀번호, 기타 인증 방식 사용자는 확인 텍스트로 본인 확인
  • 테스트

    • 회원탈퇴 기능에 대한 e2e 테스트 추가

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cha-log Ready Ready Preview, Comment Mar 16, 2026 8:42am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3e1579e-1c26-4178-8b94-b8f3ae4bbcf1

📥 Commits

Reviewing files that changed from the base of the PR and between 24a4817 and f957630.

📒 Files selected for processing (8)
  • backend/src/auth/auth.controller.ts
  • backend/src/auth/auth.module.ts
  • backend/src/auth/auth.service.ts
  • backend/src/auth/dto/withdraw.dto.ts
  • backend/test/app.e2e-spec.ts
  • backend/test/suites/auth-withdraw.e2e-spec.ts
  • src/lib/api/auth.api.ts
  • src/pages/Settings.tsx

Walkthrough

새로운 회원탈퇴 기능을 구현합니다. JWT 인증을 통한 DELETE /auth/withdraw 엔드포인트를 추가하고, 비밀번호 검증 후 사용자 계정과 관련 데이터(노트, 북마크, 토큰)를 삭제하는 트랜잭션 로직을 포함합니다. 프론트엔드에는 설정 페이지에 탈퇴 모달과 API 통합을 추가합니다.

Changes

Cohort / File(s) Summary
Backend Account Withdrawal API
backend/src/auth/auth.controller.ts, backend/src/auth/auth.service.ts, backend/src/auth/dto/withdraw.dto.ts
DELETE /auth/withdraw 엔드포인트 구현: JWT 검증, 비밀번호 확인(이메일 인증 시), 트랜잭션을 통한 사용자 계정 및 관련 데이터(노트, 리포트) 삭제, 인증 쿠키 제거. WithdrawDto 검증 추가. PATCH /auth/change-password에 throttle 래퍼 추가.
Backend Module Configuration
backend/src/auth/auth.module.ts
NotesModule을 AuthModule의 의존성으로 추가하여 회원탈퇴 시 사용자 노트 삭제 기능 지원.
Frontend Withdrawal Integration
src/pages/Settings.tsx, src/lib/api/auth.api.ts
Settings 페이지에 회원탈퇴 버튼, 확인 모달, 조건부 입력(이메일 인증 시 비밀번호, 기타 시 확인 텍스트) 추가. authApi.withdraw 메서드를 통한 API 연동 및 탈퇴 완료 후 로그아웃 및 로그인 페이지 리다이렉트 처리.
Testing & E2E
backend/test/suites/auth-withdraw.e2e-spec.ts, backend/test/app.e2e-spec.ts
회원탈퇴 엔드포인트에 대한 E2E 테스트 스위트 추가: 인증 확인, 비밀번호 검증, 정상 탈퇴, 캐스케이드 삭제 검증, 탈퇴 후 로그인 실패 확인. 기존 테스트 임포트 업데이트.

Sequence Diagram

sequenceDiagram
    participant Client as Client (Browser)
    participant Controller as AuthController
    participant Service as AuthService
    participant DB as Database
    participant NotesService as NotesService
    
    Client->>Controller: DELETE /auth/withdraw<br/>(password/confirmText)
    activate Controller
    Controller->>Controller: Extract userId from JWT
    Controller->>Service: withdraw(userId, dto)
    deactivate Controller
    
    activate Service
    Service->>DB: Verify user exists & not admin
    Service->>DB: Query user_authentications<br/>(if email-based auth)
    Service->>Service: Validate password hash<br/>(if required)
    
    rect rgba(100, 150, 200, 0.5)
        Note over Service,DB: Transaction Block
        Service->>NotesService: Remove user notes
        activate NotesService
        NotesService->>DB: Delete user notes & bookmarks
        NotesService->>DB: Delete note likes
        deactivate NotesService
        
        Service->>DB: Delete user reports<br/>(NoteReport, PostReport)
        Service->>DB: Delete user data<br/>(authentications, settings)
        Service->>DB: Delete user
    end
    
    Service->>DB: Revoke all tokens
    Service-->>Controller: Return success message
    deactivate Service
    
    Controller->>Controller: Clear access_token<br/>& refresh_token cookies
    Controller-->>Client: 200 OK { message }
    Client->>Client: Show success toast
    Client->>Client: Redirect to login page
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

✨ 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 feature/issue-258-withdraw
📝 Coding Plan
  • Generate coding plan for human review comments

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.

FLYLIKEB and others added 2 commits March 16, 2026 17:40
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@FLYLIKEB FLYLIKEB force-pushed the feature/issue-258-withdraw branch from d3ae824 to f957630 Compare March 16, 2026 08:42
@FLYLIKEB FLYLIKEB merged commit beea740 into main Mar 16, 2026
1 of 2 checks passed
@FLYLIKEB FLYLIKEB deleted the feature/issue-258-withdraw branch March 16, 2026 08:42
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.

[Feature] 회원탈퇴 기능

1 participant