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 Type
    Method
    Description
    void
    addEventView(UUID userId, UUID eventId)
    Adds a new event view for a user.
    Counts the number of user recent event views created between two timestamps.
    void
    Deletes all recent event views for a user.
    Finds all recent event views for an 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, 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

    • 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

      Optional<UserRecentEventView> findByUserIdAndEventId(UUID userId, UUID eventId)
      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

      void deleteAllByUserId(UUID userId)
      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

      @Async CompletableFuture<Long> countByCreatedAtBetween(Instant start, Instant end)
      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

      List<UserRecentEventView> findAllByEventId(UUID eventId)
      Finds all recent event views for an event.
      Parameters:
      eventId - The ID of the event.
      Returns:
      A list of user recent event views.
    • findByUserAndEvent

      Optional<UserRecentEventView> findByUserAndEvent(User user, Event event)
      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.