From 3e43efab32b44d2970b1caff6f74262eb840701d Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 6 Dec 2018 01:48:22 -0300 Subject: [PATCH] user.settings: use execute_with_json This reverts commit e3a6f2a542600d28f2fb5896a65184f031af6424. --- litecord/blueprints/user/settings.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/litecord/blueprints/user/settings.py b/litecord/blueprints/user/settings.py index 301aaa9..ef8fe71 100644 --- a/litecord/blueprints/user/settings.py +++ b/litecord/blueprints/user/settings.py @@ -1,3 +1,5 @@ +import json + from quart import Blueprint, jsonify, request, current_app as app from litecord.auth import token_check @@ -29,16 +31,10 @@ async def patch_current_settings(): for key in j: val = j[key] - jsonb_cnv = '' - # force postgres to update to jsonb - # when the fields ARE jsonb. - if key in json_fields: - jsonb_cnv = '::jsonb' - - await app.db.execute(f""" + await app.storage.execute_with_json(f""" UPDATE user_settings - SET {key}=$1{jsonb_cnv} + SET {key}=$1 WHERE id = $2 """, val, user_id)