fix postgres type translation bug and add some logs.

This commit is contained in:
fiatjaf
2021-08-01 10:30:27 -03:00
parent 83137ba0a0
commit e0496fb244
6 changed files with 37 additions and 31 deletions
-20
View File
@@ -72,26 +72,6 @@ class Wallet(NamedTuple):
return await get_wallet_payment(self.id, payment_hash)
async def get_payments(
self,
*,
complete: bool = True,
pending: bool = False,
outgoing: bool = True,
incoming: bool = True,
exclude_uncheckable: bool = False,
) -> List["Payment"]:
from .crud import get_payments
return await get_payments(
wallet_id=self.id,
complete=complete,
pending=pending,
outgoing=outgoing,
incoming=incoming,
exclude_uncheckable=exclude_uncheckable,
)
class Payment(NamedTuple):
checking_id: str
+2 -2
View File
@@ -13,7 +13,7 @@ from lnbits.decorators import api_check_wallet_key, api_validate_post_request
from lnbits.utils.exchange_rates import currencies, fiat_amount_as_satoshis
from .. import core_app, db
from ..crud import save_balance_check
from ..crud import get_payments, save_balance_check
from ..services import (
PaymentFailure,
InvoiceFailure,
@@ -42,7 +42,7 @@ async def api_wallet():
@core_app.route("/api/v1/payments", methods=["GET"])
@api_check_wallet_key("invoice")
async def api_payments():
return jsonify(await g.wallet.get_payments(pending=True)), HTTPStatus.OK
return jsonify(await get_payments(wallet_id=g.wallet.id, pending=True))
@api_check_wallet_key("invoice")