NotificationRepository

@Repository
interface NotificationRepository : JpaRepository<Notification, String> (source)

Repositório para acesso a dados de notificações do sistema. Fornece métodos para listar, marcar como lida e contar notificações.

Functions

Link copied to clipboard
abstract fun count(): Long
abstract fun <S : Notification> count(example: Example<S>): Long
Link copied to clipboard
@Query(value = " SELECT COUNT(n) FROM Notification n WHERE n.tenantId = :tenantId AND (n.userId IS NULL OR n.userId = :userId) AND n.read = false ")
abstract fun countUnreadByTenantAndUser(tenantId: String, userId: String): Long
Link copied to clipboard
abstract fun delete(entity: Notification)
Link copied to clipboard
abstract fun deleteAll()
abstract fun deleteAll(entities: MutableIterable<Notification>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun deleteAllInBatch()
Link copied to clipboard
abstract fun deleteById(id: String)
Link copied to clipboard
Link copied to clipboard
abstract fun <S : Notification> exists(example: Example<S>): Boolean
Link copied to clipboard
abstract fun existsById(id: String): Boolean
Link copied to clipboard
abstract override fun <S : Notification> findAll(example: Example<S>): MutableList<S>
abstract override fun <S : Notification> findAll(example: Example<S>, sort: Sort): MutableList<S>
abstract override fun findAll(): MutableList<Notification>
abstract override fun findAll(sort: Sort): MutableList<Notification>
abstract fun findAll(pageable: Pageable): Page<Notification>
abstract fun <S : Notification> findAll(example: Example<S>, pageable: Pageable): Page<S>
Link copied to clipboard
Link copied to clipboard
abstract fun <S : Notification, R : Any> findBy(example: Example<S>, queryFunction: Function<FluentQuery.FetchableFluentQuery<S>, R>): R
Link copied to clipboard
abstract fun findById(id: String): Optional<Notification>
Link copied to clipboard
abstract fun findByIdAndTenantId(id: String, tenantId: String): Notification?
Link copied to clipboard
@Query(value = " SELECT n FROM Notification n WHERE n.tenantId = :tenantId AND (n.userId IS NULL OR n.userId = :userId) ORDER BY n.createdAt DESC ")
abstract fun findByTenantAndUser(tenantId: String, userId: String, pageable: Pageable): Page<Notification>
Link copied to clipboard
abstract fun <S : Notification> findOne(example: Example<S>): Optional<S>
Link copied to clipboard
@Query(value = " SELECT n FROM Notification n WHERE n.tenantId = :tenantId AND (n.userId IS NULL OR n.userId = :userId) AND n.read = false ORDER BY n.createdAt DESC ")
abstract fun findUnreadByTenantAndUser(tenantId: String, userId: String): List<Notification>
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
abstract fun getById(id: String): Notification
Link copied to clipboard
abstract fun getOne(id: String): Notification
Link copied to clipboard
Link copied to clipboard
@Modifying
@Query(value = " UPDATE Notification n SET n.read = true WHERE n.tenantId = :tenantId AND (n.userId IS NULL OR n.userId = :userId) AND n.read = false ")
abstract fun markAllAsReadByTenantAndUser(tenantId: String, userId: String): Int
Link copied to clipboard
abstract fun <S : Notification> save(entity: S): S
Link copied to clipboard
abstract override fun <S : Notification> saveAll(entities: MutableIterable<S>): MutableList<S>
Link copied to clipboard
Link copied to clipboard
abstract fun <S : Notification> saveAndFlush(entity: S): S