feat(api): changed /notifications/count response
This commit is contained in:
parent
3264a424d1
commit
855830a9a8
2 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ def get_all_count(tenant_id, user_id):
|
|||
with pg_client.PostgresClient() as cur:
|
||||
cur.execute(
|
||||
cur.mogrify("""\
|
||||
SELECT COUNT(notifications.*) AS count
|
||||
SELECT COALESCE(COUNT(notifications.*),0) AS count
|
||||
FROM public.notifications
|
||||
LEFT JOIN (SELECT notification_id
|
||||
FROM public.user_viewed_notifications
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ def get_all_count(tenant_id, user_id):
|
|||
{"tenant_id": tenant_id, "user_id": user_id})
|
||||
)
|
||||
row = cur.fetchone()
|
||||
return row.get("count", 0) if row is not None else 0
|
||||
return row
|
||||
|
||||
|
||||
def view_notification(user_id, notification_ids=[], tenant_id=None, startTimestamp=None, endTimestamp=None):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue