From 9fd17d7eeb3dd1f5ea049edc50e97b58b671f1a8 Mon Sep 17 00:00:00 2001 From: wuseong Date: Sun, 11 Feb 2024 10:06:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=20=EC=99=84=EC=A0=84?= =?UTF-8?q?=20=ED=83=88=ED=87=B4=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20API=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onnoff/domain/user/controller/UserController.java | 2 +- .../com/onnoff/onnoff/domain/user/service/UserService.java | 2 ++ .../onnoff/onnoff/domain/user/service/UserServiceImpl.java | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) 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();