Conversation
Summary of ChangesHello @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은 사용자 탈퇴 기능을 구현합니다. 기존 Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
회원 탈퇴 기능 구현을 위한 PR이군요. UserWithdrawService를 추가하여 사용자를 비활성화하고 역할을 WITHDRAWN으로 변경하는 로직을 구현하셨습니다. 이를 위해 UserController에 DELETE /api/v1/users/me 엔드포인트를 추가하셨네요. 전반적으로 로직이 명확하고 구조가 좋습니다. 다만, PR 제목이 '회원가입'으로 되어 있는데, 내용과 일치하도록 '회원탈퇴'로 수정하면 더 명확할 것 같습니다. 코드에 대해서는 몇 가지 개선점을 제안드립니다.
|
|
||
| public void withdraw(Long userId) { | ||
| User user = userRepository.findById(userId) | ||
| .orElseThrow(() -> new CustomException(GeneralErrorCode.INVALID_DATA)); |
There was a problem hiding this comment.
사용자를 찾지 못했을 때 GeneralErrorCode.INVALID_DATA를 사용하셨는데, 이는 다소 일반적인 오류 코드입니다. userRepository.findById는 이미 탈퇴한 사용자를 조회하지 않기 때문에, ID가 잘못되었거나 이미 탈퇴한 경우 모두 사용자를 찾지 못하게 됩니다. 이 경우, "요청한 리소스를 찾을 수 없음"을 의미하는 GeneralErrorCode.NOT_FOUND를 사용하는 것이 의미상 더 명확합니다.
| .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 |
There was a problem hiding this comment.
Swagger UI에서 userDetails 파라미터가 입력 필드로 표시되지 않도록 @Parameter(hidden = true) 어노테이션을 추가하는 것이 좋습니다. CustomUserDetails는 클라이언트가 직접 전달하는 값이 아니라 Spring Security가 인증 컨텍스트에서 해석하여 주입해주기 때문입니다. 다른 API 메소드들과의 일관성을 위해서도 이 어노테이션을 추가하는 것을 권장합니다.
| @AuthenticationPrincipal CustomUserDetails userDetails | |
| @Parameter(hidden = true) @AuthenticationPrincipal CustomUserDetails userDetails |
Summary
회원탈퇴 api 구현
Changes
UserWithdrawService, UserController, UserSwagger, Role
Type of Change
Related Issues
Closes #325
참고 사항