Merge branch 'master' into StreamerCopilot

This commit is contained in:
Ben Arc 2021-04-21 13:41:11 +01:00
commit 1e37b9cb55
2 changed files with 5 additions and 5 deletions

View File

@ -84,22 +84,22 @@ async def create_usermanager_wallet(
return wallet_created
async def get_usermanager_wallet(wallet_id: str) -> List[Wallets]:
async def get_usermanager_wallet(wallet_id: str) -> Optional[Wallets]:
row = await db.fetchone("SELECT * FROM wallets WHERE id = ?", (wallet_id,))
return Wallets(**row) if row else None
async def get_usermanager_wallets(admin_id: str) -> List[Wallets]:
async def get_usermanager_wallets(admin_id: str) -> Optional[Wallets]:
rows = await db.fetchall("SELECT * FROM wallets WHERE admin = ?", (admin_id,))
return [Wallets(**row) for row in rows]
async def get_usermanager_users_wallets(user_id: str) -> List[Wallets]:
async def get_usermanager_users_wallets(user_id: str) -> Optional[Wallets]:
rows = await db.fetchall("SELECT * FROM wallets WHERE user = ?", (user_id,))
return [Wallets(**row) for row in rows]
async def get_usermanager_wallet_transactions(wallet_id: str) -> List[Payment]:
async def get_usermanager_wallet_transactions(wallet_id: str) -> Optional[Payment]:
return await get_payments(
wallet_id=wallet_id, complete=True, pending=False, outgoing=True, incoming=True
)

View File

@ -122,7 +122,7 @@ 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._asdict()), HTTPStatus.OK
return jsonify(wallet), HTTPStatus.OK
@usermanager_ext.route("/api/v1/wallets/<wallet_id>", methods=["DELETE"])