Skip to content

Commit

Permalink
Merge pull request #78 from snack-exercise/feat/#77
Browse files Browse the repository at this point in the history
feat : 회원 탈퇴 API 추가
  • Loading branch information
ohjinseo authored Nov 6, 2023
2 parents fa75a06 + 5335781 commit 9b3a9ed
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ public Response updateDailyGoalTime(@RequestBody UpdateDailyGoalTimeRequest requ
memberService.updateDailyGoalTime(request, loginUser.getUsername());
return Response.success();
}

@Operation(summary = "회원 탈퇴", description = "회원을 탈퇴합니다.", security = { @SecurityRequirement(name = "Authorization") })
@ResponseStatus(HttpStatus.OK)
@DeleteMapping("")
public Response delete(@AuthenticationPrincipal UserDetails loginUser) {
memberService.delete(loginUser.getUsername());
return Response.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,10 @@ public void updateDailyGoalTime(UpdateDailyGoalTimeRequest request, String email

member.updateDailyGoalTime(request.getDailyGoalTime());
}

@Transactional
public void delete(String email) {
Member member = memberRepository.findByEmailAndStatus(email, Status.ACTIVE).orElseThrow(MemberNotFoundException::new);
member.inActive();
}
}

0 comments on commit 9b3a9ed

Please sign in to comment.