Notification Repository
DAO repository for working with "notification" db table
Functions
Link copied to clipboard
@Query(value = "
SELECT EXISTS(
SELECT *
FROM notification
WHERE user_id = (SELECT user_id
FROM "user"
WHERE token = :token)
AND is_read = false
);
", nativeQuery = true )
Returns boolean whether there is any unread notification for a particular user token
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Query(value = "
SELECT *
FROM notification
WHERE user_id = (SELECT user_id
FROM "user"
WHERE token = :token)
order by "date" DESC;
", nativeQuery = true )
Returns all notification for a particular user token
@Query(value = "
SELECT *
FROM notification
WHERE user_id = (SELECT user_id
FROM "user"
WHERE token = :token)
", countQuery = "
SELECT count(*)
FROM notification
WHERE user_id = (SELECT user_id
FROM "user"
WHERE token = :token);
", nativeQuery = true )
Returns all notification for a particular user token with pagination
Link copied to clipboard
@Query(value = "
SELECT *
FROM notification
WHERE "date" < current_timestamp + INTERVAL '- 2 WEEK';
", nativeQuery = true )
Returns notifications which are older than 2 weeks
Link copied to clipboard
Link copied to clipboard