Black/prettier

This commit is contained in:
ben
2022-08-29 14:18:18 +01:00
parent 9e3cd3f00e
commit 7bfc0848ef
10 changed files with 161 additions and 136 deletions
+7 -7
View File
@@ -29,6 +29,7 @@ from .nxp424 import decryptSUN, getSunMAC
from loguru import logger
@boltcards_ext.get("/api/v1/cards")
async def api_cards(
g: WalletTypeInfo = Depends(get_key_type), all_wallets: bool = Query(False)
@@ -89,6 +90,7 @@ async def api_card_create_or_update(
card = await create_card(wallet_id=wallet.wallet.id, data=data)
return card.dict()
@boltcards_ext.get("/api/v1/cards/enable/{card_id}/{enable}", status_code=HTTPStatus.OK)
async def enable_card(
card_id,
@@ -97,16 +99,13 @@ async def enable_card(
):
card = await get_card(card_id)
if not card:
raise HTTPException(
detail="No card found.", status_code=HTTPStatus.NOT_FOUND
)
raise HTTPException(detail="No card found.", status_code=HTTPStatus.NOT_FOUND)
if card.wallet != wallet.wallet.id:
raise HTTPException(
detail="Not your card.", status_code=HTTPStatus.FORBIDDEN
)
raise HTTPException(detail="Not your card.", status_code=HTTPStatus.FORBIDDEN)
card = await enable_disable_card(enable=enable, id=card_id)
return card.dict()
@boltcards_ext.delete("/api/v1/cards/{card_id}")
async def api_card_delete(card_id, wallet: WalletTypeInfo = Depends(require_admin_key)):
card = await get_card(card_id)
@@ -139,6 +138,7 @@ async def api_hits(
return [hit.dict() for hit in await get_hits(cards_ids)]
@boltcards_ext.get("/api/v1/refunds")
async def api_hits(
g: WalletTypeInfo = Depends(get_key_type), all_wallets: bool = Query(False)
@@ -157,4 +157,4 @@ async def api_hits(
for hit in hits:
hits_ids.append(hit.id)
return [refund.dict() for refund in await get_refunds(hits_ids)]
return [refund.dict() for refund in await get_refunds(hits_ids)]