Skip to content

Commit

Permalink
refactor :: code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
miraexhoi committed Oct 21, 2024
1 parent 494a64e commit cfd9392
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ public ResponseEntity<?> registerAndAuthenticateUser(@RequestBody SignupRequest

@Operation(summary = "회원탈퇴", description = "회원탈퇴를 진행합니다.")
@DeleteMapping("/delete/{userId}")
public ResponseEntity<String> withdrawMember(@PathVariable Long userId){
try {
userService.deleteUser(userId);
return ResponseEntity.ok().body("회원탈퇴 성공");
} catch (RuntimeException ex){
return ResponseEntity.ok().body("회원탈퇴 실패");
}
public ResponseEntity<?> withdrawMember(@PathVariable Long userId){
return ResponseEntity.ok().body(userService.deleteUser(userId));
}

@Operation(summary = "프로필", description = "토큰을 이용하여 유저 정보와 대여한 기자재 및 도서 목록을 조회합니다.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface UserService {

ResponseEntity<String> updateUserData(UserInfoRequest request, Authentication authentication);

void deleteUser(Long id);
ResponseEntity<String> deleteUser(Long id);

UserDto provideUserInfo(Authentication authentication);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ public ResponseEntity<String> updateUserData(UserInfoRequest request, Authentica

@Override
@Transactional
public void deleteUser(Long id) {
public ResponseEntity<String> deleteUser(Long id) {
try {
userRepository.deleteById(id);
} catch (Exception ex) {
throw new RuntimeException();
return ResponseEntity.ok().body("회원탈퇴 성공");
} catch (Exception ex) {
throw new RuntimeException("회원탈퇴 실패", ex);
}
}

Expand Down

0 comments on commit cfd9392

Please sign in to comment.