diff --git a/src/main/java/com/onnoff/onnoff/domain/user/controller/UserController.java b/src/main/java/com/onnoff/onnoff/domain/user/controller/UserController.java index 93effde..3eda6d0 100644 --- a/src/main/java/com/onnoff/onnoff/domain/user/controller/UserController.java +++ b/src/main/java/com/onnoff/onnoff/domain/user/controller/UserController.java @@ -41,7 +41,7 @@ public ApiResponse modifyUser(@RequestBody UserRe @PutMapping("/hard-delete") @Operation(summary = "회원 완전 탈퇴 테스트 API",description = "30일 뒤에 자동 완전삭제 수동 테스트") public ApiResponse hardDeleteTest(){ - userService.deleteInactiveUsers() ; + userService.deleteInactiveUsersTest(); return ApiResponse.onSuccess("삭제완"); } diff --git a/src/main/java/com/onnoff/onnoff/domain/user/service/UserService.java b/src/main/java/com/onnoff/onnoff/domain/user/service/UserService.java index 3612b8f..47d55a8 100644 --- a/src/main/java/com/onnoff/onnoff/domain/user/service/UserService.java +++ b/src/main/java/com/onnoff/onnoff/domain/user/service/UserService.java @@ -21,5 +21,7 @@ public interface UserService { public User withdrawUser(); public void deleteInactiveUsers(); + + public void deleteInactiveUsersTest(); public User modifyUser(UserRequestDTO.ModifyUserDTO modifyUserDTO); } diff --git a/src/main/java/com/onnoff/onnoff/domain/user/service/UserServiceImpl.java b/src/main/java/com/onnoff/onnoff/domain/user/service/UserServiceImpl.java index 6e553a2..c55256f 100644 --- a/src/main/java/com/onnoff/onnoff/domain/user/service/UserServiceImpl.java +++ b/src/main/java/com/onnoff/onnoff/domain/user/service/UserServiceImpl.java @@ -94,6 +94,13 @@ public void deleteInactiveUsers() { inactiveUsers.forEach(userRepository::delete); inactiveUsers.forEach(this::disconnectApp); } + @Transactional + public void deleteInactiveUsersTest() { + LocalDateTime oneMonthAgo = LocalDateTime.now(); + List inactiveUsers = userRepository.findByStatusAndInactiveDateBefore(Status.INACTIVE, oneMonthAgo); + inactiveUsers.forEach(userRepository::delete); + inactiveUsers.forEach(this::disconnectApp); + } // 유저 소셜계정 앱 연동 해지 private void disconnectApp(User user){ SocialType socialType = user.getSocialType();