fix: add check for when notifications is empty

This commit is contained in:
Jordan Knott
2021-11-04 10:55:34 -05:00
parent 799d7f3ad0
commit de6fe78004
9 changed files with 76 additions and 37 deletions

View File

@ -39,5 +39,7 @@ SELECT * FROM notification_notified AS nn
LEFT JOIN user_account ON user_account.user_id = n.caused_by
WHERE (n.created_on, n.notification_id) < (@created_on::timestamptz, @notification_id::uuid)
AND nn.user_id = @user_id::uuid
AND (@enable_unread::boolean = false OR nn.read = false)
AND (@enable_action_type::boolean = false OR n.action_type = ANY(@action_type::text[]))
ORDER BY n.created_on DESC
LIMIT @limit_rows::int;