feat: impl traits to add, get and mark read notifications for sqlx

postgres
This commit is contained in:
realaravinth
2022-05-26 19:32:16 +05:30
parent e9921db55b
commit 44740535c2
5 changed files with 143 additions and 24 deletions

View File

@@ -0,0 +1,24 @@
-- gets all unread notifications a user has
SELECT
mcaptcha_notifications.id,
mcaptcha_notifications.heading,
mcaptcha_notifications.message,
mcaptcha_notifications.received,
mcaptcha_users.name
FROM
mcaptcha_notifications
INNER JOIN
mcaptcha_users
ON
mcaptcha_notifications.tx = mcaptcha_users.id
WHERE
mcaptcha_notifications.rx = (
SELECT
id
FROM
mcaptcha_users
WHERE
name = $1
)
AND
mcaptcha_notifications.read IS NULL;