feat(api): changed /notifications/count response

This commit is contained in:
Taha Yassine Kraiem 2022-06-24 19:51:08 +02:00
parent 3264a424d1
commit 855830a9a8
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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):