From f227be2ea56f77ef71f0763602634fa63c118b49 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Fri, 4 Oct 2024 12:07:30 +0300 Subject: [PATCH] fix: payment extra and payment hash --- lnbits/core/crud.py | 2 +- lnbits/db.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lnbits/core/crud.py b/lnbits/core/crud.py index 371a9d100..3cc87aad6 100644 --- a/lnbits/core/crud.py +++ b/lnbits/core/crud.py @@ -773,7 +773,7 @@ async def update_payment_extra( row: dict = await (conn or db).fetchone( f""" - SELECT payment_hash, extra from apipayments WHERE hash = :hash {amount_clause} + SELECT payment_hash, extra from apipayments WHERE payment_hash = :hash {amount_clause} """, {"hash": payment_hash}, ) diff --git a/lnbits/db.py b/lnbits/db.py index 54b4e5b28..3f1b931a7 100644 --- a/lnbits/db.py +++ b/lnbits/db.py @@ -650,6 +650,9 @@ def dict_to_model(_row: dict, model: type[TModel]) -> TModel: if issubclass(type_, BaseModel) and value: _dict[key] = dict_to_submodel(type_, value) continue + if type_ is dict and value: + _dict[key] = json.loads(value) + continue _dict[key] = value continue _model = model.construct(**_dict)