fix NOTIFY query

asyncpg does not allow for arguments in NOTIFY queries, hence we have to use f-strings
This commit is contained in:
Leander Furumo committed 2024-04-15 20:12:32 +02:00
1 parent 0f90e9bbf8
commit 1af28ddcbb
1 file changed
+3 -7
+3 -7
View File
@@ -114,13 +114,9 @@ async def callback(request: Request, code: str, state: str):
)
# Notify bot that user is verified
await app.state.pool.execute(
"""
NOTIFY galtinn_auth_complete, '$1 $2'
""",
discord_id,
user["sub"], # TODO: use UUID?
)
# asyncpg does not allow for arguments in NOTIFY queries, hence we use f-strings
notify_query = f"NOTIFY galtinn_auth_complete, '{discord_id} {user['sub']}'"
await app.state.pool.execute(notify_query)
return RedirectResponse(f"/success/{user['preferred_username']}", status_code=303)