Package org.localify.repositories
Interface UserRecentEventViewRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserRecentEventView,,UserRecentEventView.Key> org.springframework.data.jpa.repository.JpaRepository<UserRecentEventView,,UserRecentEventView.Key> org.springframework.data.repository.ListCrudRepository<UserRecentEventView,,UserRecentEventView.Key> org.springframework.data.repository.ListPagingAndSortingRepository<UserRecentEventView,,UserRecentEventView.Key> org.springframework.data.repository.PagingAndSortingRepository<UserRecentEventView,,UserRecentEventView.Key> org.springframework.data.repository.query.QueryByExampleExecutor<UserRecentEventView>,org.springframework.data.repository.Repository<UserRecentEventView,UserRecentEventView.Key>
@Repository
public interface UserRecentEventViewRepository
extends org.springframework.data.jpa.repository.JpaRepository<UserRecentEventView,UserRecentEventView.Key>
Repository for
UserRecentEventView entities.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventView(UUID userId, UUID eventId) Adds a new event view for a user.countByCreatedAtBetween(Instant start, Instant end) Counts the number of user recent event views created between two timestamps.voiddeleteAllByUserId(UUID userId) Deletes all recent event views for a user.findAllByEventId(UUID eventId) Finds all recent event views for an event.findByUserAndEvent(User user, Event event) Finds a user's recent event view by user and event.findByUserIdAndEventId(UUID userId, UUID eventId) Finds a user's recent event view by user ID and event ID.getByUserIdOrderByUpdatedAtDesc(UUID userId, org.springframework.data.domain.Pageable pageable) Gets a list of a user's recent event 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<UserRecentEventView>> getByUserIdOrderByUpdatedAtDesc(UUID userId, org.springframework.data.domain.Pageable pageable) Gets a list of a user's recent event 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 event views.
-
findByUserIdAndEventId
Finds a user's recent event view by user ID and event ID.- Parameters:
userId- The ID of the user.eventId- The ID of the event.- Returns:
- An optional containing the user recent event view if found, otherwise empty.
-
deleteAllByUserId
Deletes all recent event views for a user.- Parameters:
userId- The ID of the user.
-
addEventView
@Modifying @Transactional @Query(value="insert into user_recent_event_views (user_id, event_id, created_at, updated_at) values (:userId, :eventId, current_timestamp, current_timestamp) on conflict do nothing", nativeQuery=true) void addEventView(UUID userId, UUID eventId) Adds a new event view for a user.- Parameters:
userId- The ID of the user.eventId- The ID of the event.
-
countByCreatedAtBetween
Counts the number of user recent event views created between two timestamps.- Parameters:
start- The start timestamp.end- The end timestamp.- Returns:
- A completable future containing the number of views.
-
findAllByEventId
Finds all recent event views for an event.- Parameters:
eventId- The ID of the event.- Returns:
- A list of user recent event views.
-
findByUserAndEvent
Finds a user's recent event view by user and event.- Parameters:
user- The user.event- The event.- Returns:
- An optional containing the user recent event view if found, otherwise empty.
-