Package sk.iway.iwcm.users.devices
Interface DeviceRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<DeviceEntity,,Long> org.springframework.data.jpa.repository.JpaRepository<DeviceEntity,,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<DeviceEntity>,org.springframework.data.repository.ListCrudRepository<DeviceEntity,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<DeviceEntity,,Long> org.springframework.data.repository.PagingAndSortingRepository<DeviceEntity,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<DeviceEntity>,org.springframework.data.repository.Repository<DeviceEntity,Long>
@Repository
public interface DeviceRepository
extends org.springframework.data.jpa.repository.JpaRepository<DeviceEntity,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<DeviceEntity>
Stores browser recognition and notices, with every account-facing lookup scoped by user ID.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T extends Object> -
Method Summary
Modifier and TypeMethodDescriptionintclaimCodeAttempt(int userId, long id, String expectedHash, Instant expectedExpires, Instant now, boolean unblock, int maxAttempts) Claims one attempt only while the same code remains active and below its attempt limit.default longdeleteExpired(Instant cutoff) Deletes expired recognition records using the repository's bulk delete operation.org.springframework.data.domain.Page<DeviceEntity>findAllByUserId(int userId, org.springframework.data.domain.Pageable pageable) findByUserIdAndConfirmedAtIsNullAndReportedAtIsNullAndCreateDateAfterOrderByCreateDateDescIdAsc(int userId, Instant cutoff) findByUserIdAndId(int userId, long id) findByUserIdAndIdIn(int userId, Set<Long> ids) findByUserIdAndTokenHash(int userId, String tokenHash) 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.jpa.repository.JpaSpecificationExecutor
count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, updateMethods 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
-
findByUserIdAndTokenHash
-
findByUserIdAndId
-
findByUserIdAndIdIn
-
findAllByUserId
org.springframework.data.domain.Page<DeviceEntity> findAllByUserId(int userId, org.springframework.data.domain.Pageable pageable) -
findByUserIdAndConfirmedAtIsNullAndReportedAtIsNullAndCreateDateAfterOrderByCreateDateDescIdAsc
List<DeviceEntity> findByUserIdAndConfirmedAtIsNullAndReportedAtIsNullAndCreateDateAfterOrderByCreateDateDescIdAsc(int userId, Instant cutoff) -
claimCodeAttempt
@Transactional(transactionManager="webjet2022TransactionManager") @Modifying(clearAutomatically=true) @Query("UPDATE DeviceEntity d SET d.codeAttempts = d.codeAttempts + 1\nWHERE d.userId = :userId AND d.id = :id\n AND d.codeHash = :expectedHash AND d.codeExpires = :expectedExpires\n AND d.codeExpires > :now AND d.codeAttempts < :maxAttempts\n AND d.confirmedAt IS NULL\n AND ((:unblock = false AND d.reportedAt IS NULL)\n OR (:unblock = true AND d.reportedAt IS NOT NULL))\n") int claimCodeAttempt(@Param("userId") int userId, @Param("id") long id, @Param("expectedHash") String expectedHash, @Param("expectedExpires") Instant expectedExpires, @Param("now") Instant now, @Param("unblock") boolean unblock, @Param("maxAttempts") int maxAttempts) Claims one attempt only while the same code remains active and below its attempt limit.- Returns:
1when the attempt was counted, otherwise0
-
deleteExpired
Deletes expired recognition records using the repository's bulk delete operation.
-