Skip to content

Commit

Permalink
[FEAT][390] - Addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifercr07 committed Jun 10, 2024
1 parent 1c41a42 commit db7421e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ default List<User> usersSearch(UserSearchRequest request, Pageable page) {
request.getLikeIds(), request.getHideIds(), request.getBlockIds(), request.getGenderIds(), page);
}

List<User> findByConfirmedIsFalse();
List<User> findByConfirmedIsFalseAndDatesCreationDateBefore(Date date);

@Query(value = "SELECT u FROM User u WHERE u.disabled = FALSE AND u.admin = FALSE AND u.confirmed = TRUE AND u.intention IS NOT NULL AND "
+ "u.locationLatitude IS NOT NULL AND u.locationLongitude IS NOT NULL AND u.profilePicture IS NOT NULL "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ public void cleanNonConfirmedUsers(final Date date) {
ms -= nonConfirmedUsersCleanupDelay;
Date d = new Date(ms);

List<User> users = userRepo.findByConfirmedIsFalse().stream()
.filter(user -> (user.getDates() != null && user.getDates().getCreationDate().before(d)))
.toList();
List<User> users = userRepo.findByConfirmedIsFalseAndDatesCreationDateBefore(d);

userRepo.deleteAll(users);
userRepo.flush();
Expand Down

0 comments on commit db7421e

Please sign in to comment.