fix bleskomat

This commit is contained in:
Tiago vasconcelos
2021-10-27 12:01:45 +01:00
parent 336e3a833a
commit 1653c45f12
5 changed files with 20 additions and 12 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
from http import HTTPStatus
from fastapi.params import Query
from fastapi import Depends, Query
from starlette.exceptions import HTTPException
from lnbits.core.crud import get_user
@@ -19,7 +19,7 @@ from .exchange_rates import fetch_fiat_exchange_rate
@bleskomat_ext.get("/api/v1/bleskomats")
async def api_bleskomats(wallet: WalletTypeInfo(require_admin_key), all_wallets: bool = Query(False)):
async def api_bleskomats(wallet: WalletTypeInfo = Depends(require_admin_key), all_wallets: bool = Query(False)):
wallet_ids = [wallet.wallet.id]
if all_wallets:
@@ -29,7 +29,7 @@ async def api_bleskomats(wallet: WalletTypeInfo(require_admin_key), all_wallets:
@bleskomat_ext.get("/api/v1/bleskomat/{bleskomat_id}")
async def api_bleskomat_retrieve(wallet: WalletTypeInfo(require_admin_key), bleskomat_id):
async def api_bleskomat_retrieve(bleskomat_id, wallet: WalletTypeInfo = Depends(require_admin_key)):
bleskomat = await get_bleskomat(bleskomat_id)
if not bleskomat or bleskomat.wallet != wallet.wallet.id:
@@ -43,7 +43,7 @@ async def api_bleskomat_retrieve(wallet: WalletTypeInfo(require_admin_key), bles
@bleskomat_ext.post("/api/v1/bleskomat")
@bleskomat_ext.put("/api/v1/bleskomat/{bleskomat_id}",)
async def api_bleskomat_create_or_update(data: CreateBleskomat, wallet: WalletTypeInfo(require_admin_key), bleskomat_id=None):
async def api_bleskomat_create_or_update(data: CreateBleskomat, wallet: WalletTypeInfo = Depends(require_admin_key), bleskomat_id=None):
try:
fiat_currency = data.fiat_currency
exchange_rate_provider = data.exchange_rate_provider
@@ -73,7 +73,7 @@ async def api_bleskomat_create_or_update(data: CreateBleskomat, wallet: WalletTy
@bleskomat_ext.delete("/api/v1/bleskomat/{bleskomat_id}")
async def api_bleskomat_delete(wallet: WalletTypeInfo(require_admin_key), bleskomat_id):
async def api_bleskomat_delete(bleskomat_id, wallet: WalletTypeInfo = Depends(require_admin_key)):
bleskomat = await get_bleskomat(bleskomat_id)
if not bleskomat or bleskomat.wallet != wallet.wallet.id: