mirror of https://gitlab.com/litecord/litecord.git
parent
e3a6f2a542
commit
3e43efab32
|
|
@ -1,3 +1,5 @@
|
||||||
|
import json
|
||||||
|
|
||||||
from quart import Blueprint, jsonify, request, current_app as app
|
from quart import Blueprint, jsonify, request, current_app as app
|
||||||
|
|
||||||
from litecord.auth import token_check
|
from litecord.auth import token_check
|
||||||
|
|
@ -29,16 +31,10 @@ async def patch_current_settings():
|
||||||
|
|
||||||
for key in j:
|
for key in j:
|
||||||
val = j[key]
|
val = j[key]
|
||||||
jsonb_cnv = ''
|
|
||||||
|
|
||||||
# force postgres to update to jsonb
|
await app.storage.execute_with_json(f"""
|
||||||
# when the fields ARE jsonb.
|
|
||||||
if key in json_fields:
|
|
||||||
jsonb_cnv = '::jsonb'
|
|
||||||
|
|
||||||
await app.db.execute(f"""
|
|
||||||
UPDATE user_settings
|
UPDATE user_settings
|
||||||
SET {key}=$1{jsonb_cnv}
|
SET {key}=$1
|
||||||
WHERE id = $2
|
WHERE id = $2
|
||||||
""", val, user_id)
|
""", val, user_id)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue