Package org.localify.repositories
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 TypeMethodDescriptionvoidaddFavoriteVenue(@NotNull UUID userId, @NotNull UUID venueId) Adds a favorite venue for a user.countByCreatedAtBetween(Instant start, Instant end) Counts the number of favorite venues created between two timestamps.findAllByUserId(UUID userId) Finds all of a user's favorite venues.findByUserAndVenue(User user, Venue venue) 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, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByUserAndVenue
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
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
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
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.
-