Merge branch 'master' into StreamerCopilot

This commit is contained in:
Ben Arc 2021-04-21 14:03:03 +01:00
commit 39561efe38
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,5 @@
from typing import NamedTuple from typing import NamedTuple
from sqlite3 import Row
class Users(NamedTuple): class Users(NamedTuple):
@ -16,3 +17,7 @@ class Wallets(NamedTuple):
user: str user: str
adminkey: str adminkey: str
inkey: str inkey: str
@classmethod
def from_row(cls, row: Row) -> "Wallets":
return cls(**dict(row))

View File

@ -122,7 +122,15 @@ async def api_usermanager_wallet_transactions(wallet_id):
@api_check_wallet_key(key_type="invoice") @api_check_wallet_key(key_type="invoice")
async def api_usermanager_users_wallets(user_id): async def api_usermanager_users_wallets(user_id):
wallet = await get_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/<wallet_id>", methods=["DELETE"]) @usermanager_ext.route("/api/v1/wallets/<wallet_id>", methods=["DELETE"])