Interface UserSeedRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserSeedArtist,UUID>, org.springframework.data.jpa.repository.JpaRepository<UserSeedArtist,UUID>, org.springframework.data.repository.ListCrudRepository<UserSeedArtist,UUID>, org.springframework.data.repository.ListPagingAndSortingRepository<UserSeedArtist,UUID>, org.springframework.data.repository.PagingAndSortingRepository<UserSeedArtist,UUID>, org.springframework.data.repository.query.QueryByExampleExecutor<UserSeedArtist>, org.springframework.data.repository.Repository<UserSeedArtist,UUID>

public interface UserSeedRepository extends org.springframework.data.jpa.repository.JpaRepository<UserSeedArtist,UUID>
Repository for UserSeedArtist entities.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Counts the number of discovered artists.
    Counts the number of discovered artists between two timestamps.
    void
    Deletes all non-blacklisted seed artists for a user.
    Finds the most recently created user seed artist.
    getByUserId(UUID userId)
    Gets a list of a user's seed artists.
    getByUserIdAndArtistId(UUID userId, UUID artistId)
    Gets a user's seed artist by user ID and artist ID.
    Gets a list of a user's non-blacklisted seed artists.
    Gets a list of a user's blacklisted seed artists.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • getByUserIdAndBlacklistedAtIsNull

      List<UserSeedArtist> getByUserIdAndBlacklistedAtIsNull(UUID userId)
      Gets a list of a user's non-blacklisted seed artists.
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of user seed artists.
    • getByUserId

      List<UserSeedArtist> getByUserId(UUID userId)
      Gets a list of a user's seed artists.
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of user seed artists.
    • getByUserIdAndArtistId

      Optional<UserSeedArtist> getByUserIdAndArtistId(UUID userId, UUID artistId)
      Gets a user's seed artist by user ID and artist ID.
      Parameters:
      userId - The ID of the user.
      artistId - The ID of the artist.
      Returns:
      An optional containing the user seed artist if found, otherwise empty.
    • getByUserIdAndBlacklistedAtNotNull

      List<UserSeedArtist> getByUserIdAndBlacklistedAtNotNull(UUID userId)
      Gets a list of a user's blacklisted seed artists.
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of user seed artists.
    • deleteAllByUserIdAndBlacklistedAtIsNull

      void deleteAllByUserIdAndBlacklistedAtIsNull(UUID userId)
      Deletes all non-blacklisted seed artists for a user.
      Parameters:
      userId - The ID of the user.
    • findTopByOrderByCreatedAt

      UserSeedArtist findTopByOrderByCreatedAt()
      Finds the most recently created user seed artist.
      Returns:
      The user seed artist.
    • countDiscoveredArtists

      @Query(value="select count(distinct usa.user_id || \'-\' || usa.artist_id)\nfrom user_seed_artists usa\njoin user_recommendations ur\n on usa.user_id = ur.user_id\n and usa.created_at > ur.created_at\njoin user_artist_recommendations uar\n on ur.id = uar.user_rec_id\n and usa.artist_id = uar.artist_id\nwhere usa.blacklisted_at is null;\n", nativeQuery=true) int countDiscoveredArtists()
      Counts the number of discovered artists.
      Returns:
      The number of discovered artists.
    • countDiscoveredArtistsByTime

      @Async @Query(value="select count(distinct usa.user_id || \'-\' || usa.artist_id)\nfrom user_seed_artists usa\njoin user_recommendations ur\n on usa.user_id = ur.user_id\n and usa.created_at > ur.created_at\njoin user_artist_recommendations uar\n on ur.id = uar.user_rec_id\n and usa.artist_id = uar.artist_id\nwhere usa.blacklisted_at is null\nand usa.created_at >= :start and usa.created_at <= :end\n", nativeQuery=true) CompletableFuture<Long> countDiscoveredArtistsByTime(Instant start, Instant end)
      Counts the number of discovered artists between two timestamps.
      Parameters:
      start - The start timestamp.
      end - The end timestamp.
      Returns:
      A completable future containing the number of discovered artists.