-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: Add soft delete * feature: Social login disconnect * fix: Exclude Apple social login disconnect * fix: Change error code * refactor: Inline address deletion Co-authored-by: Chanhyeok Seo <[email protected]> --------- Co-authored-by: Chanhyeok Seo <[email protected]>
- Loading branch information
1 parent
de24189
commit 6cfb02b
Showing
12 changed files
with
195 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/example/repick/domain/user/scheduler/UserScheduler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.repick.domain.user.scheduler; | ||
|
||
import com.example.repick.domain.product.entity.Payment; | ||
import com.example.repick.domain.product.repository.PaymentRepository; | ||
import com.example.repick.domain.user.entity.User; | ||
import com.example.repick.domain.user.repository.UserRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class UserScheduler { | ||
|
||
private final UserRepository userRepository; | ||
private final PaymentRepository paymentRepository; | ||
|
||
// λ§€μΌ μμ μ μ€νλλ μ€μΌμ€λ¬ | ||
@Scheduled(cron = "0 0 0 * * *") | ||
public void deleteSoftDeletedUsers() { | ||
// 30μΌμ΄ μ§λ μννΈ μμ λ μ¬μ©μ μ‘°ν | ||
LocalDateTime thirtyDaysAgo = LocalDateTime.now().minusDays(30); | ||
List<User> usersToDelete = userRepository.findAllByDeletedAtBefore(thirtyDaysAgo); | ||
|
||
userRepository.deleteAll(usersToDelete); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.