diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/notif.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/backend/notif.py b/backend/notif.py index 15977a0..8de4d4c 100644 --- a/backend/notif.py +++ b/backend/notif.py @@ -27,15 +27,22 @@ CREATE TABLE IF NOT EXISTS subscriptions ( # --- subscribe def subscribe(data: PushSubscriptionData): cursor.execute("SELECT * FROM subscriptions WHERE endpoint = ?", (data.endpoint,)) - row = cursor.fetchall() + result = cursor.fetchall() - if len(row) > 0: + if len(result) > 0: return data.endpoint cursor.execute(""" INSERT INTO subscriptions (endpoint, keys_p256dh, keys_auth) VALUES (?, ?, ?)""", (data.endpoint, data.keys["p256dh"], data.keys["auth"])) conn.commit() + + cursor.execute("SELECT * FROM subscriptions"); + result = cursor.fetchall() + + for row in result: + print(row) + return data.endpoint |
