Interface UserFavoriteVenueRepository

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

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

    Modifier and Type
    Method
    Description
    void
    addFavoriteVenue(@NotNull UUID userId, @NotNull UUID venueId)
    Adds a favorite venue for a user.
    Counts the number of favorite venues created between two timestamps.
    Finds all of a user's favorite venues.
    Finds a user's favorite venue by user and venue.
    org.springframework.data.domain.Page<UserFavoriteVenue>
    findByUserId(UUID userId, org.springframework.data.domain.Pageable pageable)
    Finds a page of a user's favorite venues.
    findByUserIdAndVenueId(UUID userId, UUID venueId)
    Finds a user's favorite venue by user ID and venue ID.

    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

    • findByUserAndVenue

      Optional<UserFavoriteVenue> findByUserAndVenue(User user, Venue venue)
      Finds a user's favorite venue by user and venue.
      Parameters:
      user - The user.
      venue - The venue.
      Returns:
      An optional containing the user's favorite venue if found, otherwise empty.
    • findByUserIdAndVenueId

      Optional<UserFavoriteVenue> findByUserIdAndVenueId(UUID userId, UUID venueId)
      Finds a user's favorite venue by user ID and venue ID.
      Parameters:
      userId - The ID of the user.
      venueId - The ID of the venue.
      Returns:
      An optional containing the user's favorite venue if found, otherwise empty.
    • findByUserId

      org.springframework.data.domain.Page<UserFavoriteVenue> findByUserId(UUID userId, org.springframework.data.domain.Pageable pageable)
      Finds a page of a user's favorite venues.
      Parameters:
      userId - The ID of the user.
      pageable - The pageable request.
      Returns:
      A page of user favorite venues.
    • findAllByUserId

      List<UserFavoriteVenue> findAllByUserId(UUID userId)
      Finds all of a user's favorite venues.
      Parameters:
      userId - The ID of the user.
      Returns:
      A list of user favorite venues.
    • addFavoriteVenue

      @Modifying @Query(value="insert into user_favorite_venues (user_id, venue_id, created_at) values (:userId, :venueId, current_timestamp) on conflict do nothing", nativeQuery=true) void addFavoriteVenue(@NotNull @NotNull UUID userId, @NotNull @NotNull UUID venueId)
      Adds a favorite venue for a user.
      Parameters:
      userId - The ID of the user.
      venueId - The ID of the venue.
    • countByCreatedAtBetween

      @Async CompletableFuture<Long> countByCreatedAtBetween(Instant start, Instant end)
      Counts the number of favorite venues created between two timestamps.
      Parameters:
      start - The start timestamp.
      end - The end timestamp.
      Returns:
      A completable future containing the number of favorite venues.