Skip to content

[FEAT] 회원가입 API 구현 (#325)#334

Merged
lingard1234 merged 3 commits intodevfrom
feat/325-deleteuser
Feb 8, 2026
Merged

[FEAT] 회원가입 API 구현 (#325)#334
lingard1234 merged 3 commits intodevfrom
feat/325-deleteuser

Conversation

@lingard1234
Copy link
Copy Markdown
Contributor

Summary

회원탈퇴 api 구현

Changes

UserWithdrawService, UserController, UserSwagger, Role

Type of Change

  • Bug fix (기존 기능에 영향을 주지 않는 버그 수정)
  • New feature (기존 기능에 영향을 주지 않는 새로운 기능 추가)
  • Breaking change (기존 기능에 영향을 주는 수정)
  • Refactoring (기능 변경 없는 코드 개선)
  • Documentation (문서 수정)
  • Chore (빌드, 설정 등 기타 변경)
  • Release (develop → main 배포)

Related Issues

Closes #325

참고 사항

@lingard1234 lingard1234 self-assigned this Feb 8, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @lingard1234, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자 탈퇴 기능을 구현합니다. 기존 User 엔티티의 소프트 삭제 로직을 withdraw 메서드로 개선하고, 탈퇴한 사용자에게 WITHDRAWN 역할을 부여하여 시스템 내에서 해당 사용자의 상태를 명확히 관리합니다. 이는 탈퇴 사용자가 특정 비즈니스 로직(예: 제안 생성)에 참여하는 것을 방지하고, 데이터 일관성 및 보안을 강화하는 데 기여합니다.

Highlights

  • WITHDRAWN 역할 도입: 사용자 탈퇴 시 할당되는 새로운 WITHDRAWN 역할이 Role enum에 추가되었습니다.
  • 사용자 탈퇴 서비스 구현: UserWithdrawService가 신규 추가되어 사용자 탈퇴 로직을 캡슐화하고, 사용자의 역할을 WITHDRAWN으로 변경합니다.
  • 탈퇴 API 엔드포인트 추가: UserControllerDELETE /me 엔드포인트가 추가되어 인증된 사용자가 자신의 계정을 탈퇴할 수 있도록 합니다.
  • ProposalDirection 로직 업데이트: WITHDRAWN 역할을 가진 사용자가 제안 방향을 설정하려 할 경우 예외를 발생시키도록 ProposalDirection enum의 로직이 확장되었습니다.
Changelog
  • src/main/java/com/example/RealMatch/business/domain/enums/ProposalDirection.java
    • fromWhoProposed 메서드에 WITHDRAWN 역할을 추가하여, 탈퇴한 사용자가 제안 방향을 설정할 수 없도록 예외 처리 로직을 확장했습니다.
  • src/main/java/com/example/RealMatch/user/application/service/UserWithdrawService.java
    • 사용자 탈퇴 로직을 담당하는 새로운 서비스 클래스가 추가되었습니다. 이 서비스는 userId를 받아 사용자를 찾아 withdraw 메서드를 호출합니다.
  • src/main/java/com/example/RealMatch/user/domain/entity/User.java
    • softDelete 메서드의 이름을 withdraw로 변경하고, 탈퇴 시 사용자의 roleRole.WITHDRAWN으로 설정하는 로직을 추가했습니다.
  • src/main/java/com/example/RealMatch/user/domain/entity/enums/Role.java
    • 사용자 역할 목록에 WITHDRAWN이라는 새로운 열거형 상수를 추가했습니다.
  • src/main/java/com/example/RealMatch/user/presentation/controller/UserController.java
    • UserWithdrawService를 주입하고, 현재 로그인한 사용자의 탈퇴를 처리하는 DELETE /me 엔드포인트를 추가했습니다.
  • src/main/java/com/example/RealMatch/user/presentation/swagger/UserSwagger.java
    • 새로 추가된 사용자 탈퇴 API 엔드포인트에 대한 Swagger 문서(요약 및 설명)를 추가했습니다.
Activity
  • 이 PR은 lingard1234에 의해 생성되었으며, 현재까지 다른 사람의 코멘트나 리뷰 활동은 없습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

회원 탈퇴 기능 구현을 위한 PR이군요. UserWithdrawService를 추가하여 사용자를 비활성화하고 역할을 WITHDRAWN으로 변경하는 로직을 구현하셨습니다. 이를 위해 UserControllerDELETE /api/v1/users/me 엔드포인트를 추가하셨네요. 전반적으로 로직이 명확하고 구조가 좋습니다. 다만, PR 제목이 '회원가입'으로 되어 있는데, 내용과 일치하도록 '회원탈퇴'로 수정하면 더 명확할 것 같습니다. 코드에 대해서는 몇 가지 개선점을 제안드립니다.


public void withdraw(Long userId) {
User user = userRepository.findById(userId)
.orElseThrow(() -> new CustomException(GeneralErrorCode.INVALID_DATA));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

사용자를 찾지 못했을 때 GeneralErrorCode.INVALID_DATA를 사용하셨는데, 이는 다소 일반적인 오류 코드입니다. userRepository.findById는 이미 탈퇴한 사용자를 조회하지 않기 때문에, ID가 잘못되었거나 이미 탈퇴한 경우 모두 사용자를 찾지 못하게 됩니다. 이 경우, "요청한 리소스를 찾을 수 없음"을 의미하는 GeneralErrorCode.NOT_FOUND를 사용하는 것이 의미상 더 명확합니다.

Suggested change
.orElseThrow(() -> new CustomException(GeneralErrorCode.INVALID_DATA));
.orElseThrow(() -> new CustomException(GeneralErrorCode.NOT_FOUND));


@Operation(summary = "회원 탈퇴", description = "회원 탈퇴(Soft Delete) 처리 후 role을 WITHDRAWN으로 변경합니다.")
CustomResponse<Void> withdraw(
@AuthenticationPrincipal CustomUserDetails userDetails
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Swagger UI에서 userDetails 파라미터가 입력 필드로 표시되지 않도록 @Parameter(hidden = true) 어노테이션을 추가하는 것이 좋습니다. CustomUserDetails는 클라이언트가 직접 전달하는 값이 아니라 Spring Security가 인증 컨텍스트에서 해석하여 주입해주기 때문입니다. 다른 API 메소드들과의 일관성을 위해서도 이 어노테이션을 추가하는 것을 권장합니다.

Suggested change
@AuthenticationPrincipal CustomUserDetails userDetails
@Parameter(hidden = true) @AuthenticationPrincipal CustomUserDetails userDetails

@lingard1234 lingard1234 merged commit ee5721b into dev Feb 8, 2026
1 check passed
@lingard1234 lingard1234 deleted the feat/325-deleteuser branch February 8, 2026 17:36
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.

[FEAT] 회원 탈퇴 API 구현

1 participant