feat(api): fixed notifications count query
This commit is contained in:
parent
06a52e505e
commit
7d426ee79a
2 changed files with 2 additions and 6 deletions
|
|
@ -34,9 +34,7 @@ def get_all_count(tenant_id, user_id):
|
|||
LEFT JOIN (SELECT notification_id
|
||||
FROM public.user_viewed_notifications
|
||||
WHERE user_viewed_notifications.user_id = %(user_id)s) AS user_viewed_notifications USING (notification_id)
|
||||
WHERE (notifications.user_id IS NULL OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 100;""",
|
||||
WHERE (notifications.user_id IS NULL OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL;""",
|
||||
{"user_id": user_id})
|
||||
)
|
||||
row = cur.fetchone()
|
||||
|
|
|
|||
|
|
@ -36,9 +36,7 @@ def get_all_count(tenant_id, user_id):
|
|||
FROM public.user_viewed_notifications
|
||||
WHERE user_viewed_notifications.user_id = %(user_id)s) AS user_viewed_notifications USING (notification_id)
|
||||
WHERE (notifications.tenant_id =%(tenant_id)s
|
||||
OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 100;""",
|
||||
OR notifications.user_id =%(user_id)s) AND user_viewed_notifications.notification_id IS NULL;""",
|
||||
{"tenant_id": tenant_id, "user_id": user_id})
|
||||
)
|
||||
rows = helper.list_to_camel_case(cur.fetchall())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue