1313import lombok .RequiredArgsConstructor ;
1414import org .springframework .http .ResponseEntity ;
1515import org .springframework .security .core .annotation .AuthenticationPrincipal ;
16- import org .springframework .web .bind .annotation .ModelAttribute ;
17- import org .springframework .web .bind .annotation .PatchMapping ;
18- import org .springframework .web .bind .annotation .RequestMapping ;
19- import org .springframework .web .bind .annotation .RestController ;
16+ import org .springframework .web .bind .annotation .*;
2017
2118import java .io .IOException ;
2219
@@ -36,10 +33,23 @@ public class UsersController {
3633 @ ApiResponse (content = @ Content (schema = @ Schema (implementation = UpdateProfileResponse .class )))
3734 @ PatchMapping ("/profile" )
3835 public ResponseEntity <UpdateProfileResponse > updateProfile (
39- @ AuthenticationPrincipal CustomUserDetails userDetails ,
36+ @ AuthenticationPrincipal CustomUserDetails me ,
4037 @ ModelAttribute UpdateProfileRequest request // MultipartFile + String κ°μ΄ λ°κΈ° μν΄ @ModelAttribute
4138 ) throws IOException {
42- UpdateProfileResponse response = usersService .updateProfile (userDetails .getId (), request );
39+ UpdateProfileResponse response = usersService .updateProfile (me .getId (), request );
4340 return ResponseEntity .ok (response );
4441 }
42+
43+ @ Operation (
44+ summary = "κ³μ νν΄" ,
45+ description = "κ³μ μ 보λ₯Ό μμ νκ³ , μλΉμ€μμ νν΄ν©λλ€"
46+ )
47+ @ ApiResponse (content = @ Content (schema = @ Schema (implementation = String .class )))
48+ @ DeleteMapping ("/account" )
49+ public ResponseEntity <String > deleteMyAccount (
50+ @ AuthenticationPrincipal CustomUserDetails me
51+ ) {
52+ usersService .deleteAccount (me .getId ());
53+ return ResponseEntity .ok ("μλΉμ€μμ νν΄νμμ΅λλ€" );
54+ }
4555}
0 commit comments