Package org.localify.repositories
Interface UserRecentVenueViewRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserRecentVenueView,,UserRecentVenueView.Key> org.springframework.data.jpa.repository.JpaRepository<UserRecentVenueView,,UserRecentVenueView.Key> org.springframework.data.repository.ListCrudRepository<UserRecentVenueView,,UserRecentVenueView.Key> org.springframework.data.repository.ListPagingAndSortingRepository<UserRecentVenueView,,UserRecentVenueView.Key> org.springframework.data.repository.PagingAndSortingRepository<UserRecentVenueView,,UserRecentVenueView.Key> org.springframework.data.repository.query.QueryByExampleExecutor<UserRecentVenueView>,org.springframework.data.repository.Repository<UserRecentVenueView,UserRecentVenueView.Key>
@Repository
public interface UserRecentVenueViewRepository
extends org.springframework.data.jpa.repository.JpaRepository<UserRecentVenueView,UserRecentVenueView.Key>
Repository for
UserRecentVenueView entities.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddVenueView(UUID userId, UUID venueId) Adds a new venue view for a user.countByCreatedAtBetween(Instant start, Instant end) Counts the number of user recent venue views created between two timestamps.voiddeleteAllByUserId(UUID userId) Deletes all recent venue views for a user.findByUserIdAndVenueId(UUID userId, UUID venueId) Finds a user's recent venue view by user ID and venue ID.getByUserIdOrderByUpdatedAtDesc(UUID userId, org.springframework.data.domain.Pageable pageable) Gets a list of a user's recent venue views, ordered by last updated time.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
-
getByUserIdOrderByUpdatedAtDesc
@Async CompletableFuture<List<UserRecentVenueView>> getByUserIdOrderByUpdatedAtDesc(UUID userId, org.springframework.data.domain.Pageable pageable) Gets a list of a user's recent venue views, ordered by last updated time.- Parameters:
userId- The ID of the user.pageable- The pageable request.- Returns:
- A completable future containing a list of user recent venue views.
-
findByUserIdAndVenueId
Finds a user's recent venue view 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 recent venue view if found, otherwise empty.
-
deleteAllByUserId
Deletes all recent venue views for a user.- Parameters:
userId- The ID of the user.
-
addVenueView
@Modifying @Transactional @Query(value="insert into user_recent_venue_views (user_id, venue_id, created_at, updated_at) values (:userId, :venueId, current_timestamp, current_timestamp) on conflict do nothing", nativeQuery=true) void addVenueView(UUID userId, UUID venueId) Adds a new venue view for a user.- Parameters:
userId- The ID of the user.venueId- The ID of the venue.
-
countByCreatedAtBetween
Counts the number of user recent venue views created between two timestamps.- Parameters:
start- The start timestamp.end- The end timestamp.- Returns:
- A completable future containing the number of views.
-