content: package com.konsol.beatstream.repository;
  
  import com.konsol.beatstream.domain.User;
  import java.time.Instant;
  import java.util.List;
  import java.util.Optional;
  import org.springframework.cache.annotation.Cacheable;
  import org.springframework.data.domain.*;
  import org.springframework.data.mongodb.repository.MongoRepository;
  import org.springframework.stereotype.Repository;
  
  /**
   * Spring Data MongoDB repository for the {@link User} entity.
   */
  @Repository
  public interface UserRepository extends MongoRepository<User, String> {
      String USERS_BY_LOGIN_CACHE = "usersByLogin";
  
      String USERS_BY_EMAIL_CACHE = "usersByEmail";
      Optional<User> findOneByActivationKey(String activationKey);
      List<User> findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(Instant dateTime);
      Optional<User> findOneByResetKey(String resetKey);
  
      @Cacheable(cacheNames = USERS_BY_EMAIL_CACHE)
      Optional<User> findOneByEmailIgnoreCase(String email);
  
      @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE)
      Optional<User> findOneByLogin(String login);
  
      Page<User> findAllByIdNotNullAndActivatedIsTrue(Pageable pageable);
  }
  