Skip to content

Commit bd841b3

Browse files
committed
feat: 회원 계정 비활성화 API 구현
- DELETE /me/account 엔드포인트를 통해 계정 탈퇴 기능 제공 - UserService의 deactivateAccount 메서드 호출로 사용자 상태 변경 및 개인정보 익명화 처리 - 탈퇴 후 현재 세션 및 리프레시 토큰을 정리하는 로그아웃 로직 추가
1 parent 95cda35 commit bd841b3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.back.domain.user.controller;
2+
3+
import com.back.domain.user.service.UserService;
4+
import com.back.domain.user.service.UserAuthService;
5+
import com.back.global.rsData.RsData;
6+
import io.swagger.v3.oas.annotations.Operation;
7+
import jakarta.servlet.http.HttpServletRequest;
8+
import jakarta.servlet.http.HttpServletResponse;
9+
import lombok.RequiredArgsConstructor;
10+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
11+
import org.springframework.web.bind.annotation.DeleteMapping;
12+
import org.springframework.web.bind.annotation.RequestMapping;
13+
import org.springframework.web.bind.annotation.RestController;
14+
15+
@RestController
16+
@RequestMapping("/me/account")
17+
@RequiredArgsConstructor
18+
public class UserAccountController {
19+
20+
private final UserService userService;
21+
private final UserAuthService userAuthService;
22+
23+
@DeleteMapping
24+
@Operation(summary = "계정 비활성화(Soft Delete)", description = "DELETE /me/account: 사용자 상태를 DELETED로 전환하고 세션/토큰을 정리합니다.")
25+
public RsData<Void> deactivate(
26+
@AuthenticationPrincipal(expression = "id") Long userId,
27+
HttpServletRequest request,
28+
HttpServletResponse response
29+
) {
30+
userService.deactivateAccount(userId);
31+
32+
// 현재 세션 쿠키 및 리프레시토큰 제거
33+
userAuthService.logout(request, response);
34+
35+
return RsData.of(200, "계정 비활성화(탈퇴)가 완료되었습니다.");
36+
}
37+
}

0 commit comments

Comments
 (0)