From daff0199205a1bf02d161633e7ea9a307ef1d805 Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Wed, 21 Apr 2021 14:02:52 +0100 Subject: [PATCH] Fixed usermanager ext --- lnbits/extensions/usermanager/models.py | 5 +++++ lnbits/extensions/usermanager/views_api.py | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lnbits/extensions/usermanager/models.py b/lnbits/extensions/usermanager/models.py index bc233d43..97eaaea8 100644 --- a/lnbits/extensions/usermanager/models.py +++ b/lnbits/extensions/usermanager/models.py @@ -1,4 +1,5 @@ from typing import NamedTuple +from sqlite3 import Row class Users(NamedTuple): @@ -16,3 +17,7 @@ class Wallets(NamedTuple): user: str adminkey: str inkey: str + + @classmethod + def from_row(cls, row: Row) -> "Wallets": + return cls(**dict(row)) diff --git a/lnbits/extensions/usermanager/views_api.py b/lnbits/extensions/usermanager/views_api.py index 4de50d0e..37c60446 100644 --- a/lnbits/extensions/usermanager/views_api.py +++ b/lnbits/extensions/usermanager/views_api.py @@ -122,7 +122,15 @@ async def api_usermanager_wallet_transactions(wallet_id): @api_check_wallet_key(key_type="invoice") async def api_usermanager_users_wallets(user_id): wallet = await get_usermanager_users_wallets(user_id) - return jsonify(wallet), HTTPStatus.OK + return ( + jsonify( + [ + wallet._asdict() + for wallet in await get_usermanager_users_wallets(user_id) + ] + ), + HTTPStatus.OK, + ) @usermanager_ext.route("/api/v1/wallets/", methods=["DELETE"])