NotificationsRepository

@Service
@Repository
interface NotificationsRepository : JpaRepository<T, ID>

The NotificationsRepository interface is useful to manage the queries for the notifications of the users

Author

N7ghtm4r3 - Tecknobit

See also

JpaRepository

Functions

Link copied to clipboard
abstract fun <S : T?> count(example: Example<S>): Long
Link copied to clipboard
abstract fun delete(entity: T)
Link copied to clipboard
abstract fun deleteAll(entities: Iterable<out T>)
Link copied to clipboard
abstract fun deleteAllById(ids: Iterable<out ID>)
Link copied to clipboard
abstract fun deleteAllByIdInBatch(ids: Iterable<ID>)
Link copied to clipboard
abstract fun deleteAllInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun deleteById(id: ID)
Link copied to clipboard
open fun deleteInBatch(entities: Iterable<T>)
Link copied to clipboard
abstract fun <S : T?> exists(example: Example<S>): Boolean
Link copied to clipboard
abstract fun existsById(id: ID): Boolean
Link copied to clipboard
abstract fun <S : T?> findAll(example: Example<S>): List<S>
abstract fun findAll(): Iterable<T>
abstract fun findAll(): List<T>
abstract fun findAll(pageable: Pageable): Page<T>
abstract fun <S : T?> findAll(example: Example<S>): Iterable<S>
abstract fun <S : T?> findAll(example: Example<S>, pageable: Pageable): Page<S>
Link copied to clipboard
abstract fun findAllById(ids: Iterable<ID>): Iterable<T>
abstract fun findAllById(ids: Iterable<ID>): List<T>
Link copied to clipboard
abstract fun <S : T?, R> findBy(example: Example<S>, queryFunction: (FluentQuery.FetchableFluentQuery<S>) -> R): R
Link copied to clipboard
abstract fun findById(id: ID): Optional<T>
Link copied to clipboard
abstract fun <S : T?> findOne(example: Example<S>): Optional<S>
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
abstract fun getById(id: ID): T
Link copied to clipboard
abstract fun getOne(id: ID): T
Link copied to clipboard
abstract fun getReferenceById(id: ID): T
Link copied to clipboard
@Query(value = ""SELECT * FROM " + NOTIFICATIONS_KEY + " WHERE " + USER_KEY + "=:" + USER_KEY", nativeQuery = true)
abstract fun getUserNotifications(@Param(value = "user") userId: String): List<NovaNotification>
Method to execute the query to select all the notifications of a user
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + NOTIFICATIONS_KEY + " (" + IDENTIFIER_KEY + "," + LOGO_URL_KEY + "," + RELEASE_IDENTIFIER_KEY + "," + RELEASE_VERSION_KEY + "," + RELEASE_STATUS_KEY + "," + USER_KEY + " )" + " VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + LOGO_URL_KEY + "," + ":" + RELEASE_IDENTIFIER_KEY + "," + ":" + RELEASE_VERSION_KEY + "," + ":" + RELEASE_STATUS_KEY + "," + ":" + USER_KEY + ")", nativeQuery = true)
abstract fun insertNotification(@Param(value = "id") id: String, @Param(value = "logo_url") projectLogo: String, @Param(value = "release_id") releaseId: String, @Param(value = "release_version") releaseVersion: String, @Param(value = "release_status") releaseStatus: String, @Param(value = "user") userId: String)
Method to execute the query to insert a new NovaNotification
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + NOTIFICATIONS_KEY + " (" + IDENTIFIER_KEY + "," + LOGO_URL_KEY + "," + USER_KEY + " )" + " VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + LOGO_URL_KEY + "," + ":" + USER_KEY + ")", nativeQuery = true)
abstract fun insertProjectDeletedNotification(@Param(value = "id") id: String, @Param(value = "logo_url") projectLogo: String, @Param(value = "user") userId: String)
Method to execute the query to insert a new NovaNotification when a project has been deleted
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "INSERT INTO " + NOTIFICATIONS_KEY + " (" + IDENTIFIER_KEY + "," + LOGO_URL_KEY + "," + RELEASE_VERSION_KEY + "," + USER_KEY + " )" + " VALUES (" + ":" + IDENTIFIER_KEY + "," + ":" + LOGO_URL_KEY + "," + ":" + RELEASE_VERSION_KEY + "," + ":" + USER_KEY + ")", nativeQuery = true)
abstract fun insertReleaseDeletedNotification(@Param(value = "id") id: String, @Param(value = "logo_url") projectLogo: String, @Param(value = "release_version") releaseVersion: String, @Param(value = "user") userId: String)
Method to execute the query to insert a new NovaNotification when a release has been deleted
Link copied to clipboard
abstract fun <S : T?> save(entity: S): S
Link copied to clipboard
abstract fun <S : T?> saveAll(entities: Iterable<S>): Iterable<S>
abstract fun <S : T?> saveAll(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAllAndFlush(entities: Iterable<S>): List<S>
Link copied to clipboard
abstract fun <S : T?> saveAndFlush(entity: S): S
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "DELETE FROM " + NOTIFICATIONS_KEY + " WHERE " + USER_KEY + "=:" + USER_KEY + " AND " + RELEASE_IDENTIFIER_KEY + "=:" + RELEASE_IDENTIFIER_KEY + " AND " + IS_SENT_KEY + "='" + 1 + "'", nativeQuery = true)
abstract fun setUserNotificationsAsRed(@Param(value = "user") userId: String, @Param(value = "release_id") releaseId: String)
Method to execute the query to set as red all the notifications of a user deleting the related records
Link copied to clipboard
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE " + NOTIFICATIONS_KEY + " SET " + IS_SENT_KEY + "='" + 1 + "' WHERE " + USER_KEY + "=:" + USER_KEY + " AND " + IS_SENT_KEY + "='" + 0 + "'", nativeQuery = true)
abstract fun setUserNotificationsAsSent(@Param(value = "user") userId: String)
Method to execute the query to set as sent all the notifications of a user