From fc61c15444d7376b0af579a07b174090c277a107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Thu, 22 Jun 2023 10:24:42 +0200 Subject: [PATCH] fix for latest fastapi (#3) https://github.com/lnbits/lnbits/pull/1609 --- views.py | 4 ++-- views_api.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/views.py b/views.py index ddb1b63..f137e0a 100644 --- a/views.py +++ b/views.py @@ -1,6 +1,6 @@ from http import HTTPStatus -from fastapi import Depends, Query, Request +from fastapi import Depends, Request from fastapi.templating import Jinja2Templates from starlette.exceptions import HTTPException @@ -21,7 +21,7 @@ async def index(request: Request, user: User = Depends(check_user_exists)): @tipjar_ext.get("/{tipjar_id}") -async def tip(request: Request, tipjar_id: int = Query(None)): +async def tip(request: Request, tipjar_id: int): """Return the donation form for the Tipjar corresponding to id""" tipjar = await get_tipjar(tipjar_id) if not tipjar: diff --git a/views_api.py b/views_api.py index 5e63254..233eed9 100644 --- a/views_api.py +++ b/views_api.py @@ -124,8 +124,8 @@ async def api_get_tips(wallet: WalletTypeInfo = Depends(get_key_type)): @tipjar_ext.put("/api/v1/tips/{tip_id}") async def api_update_tip( data: createTip, + tip_id: str, wallet: WalletTypeInfo = Depends(get_key_type), - tip_id: str = Query(None), ): """Update a tip with the data given in the request""" if tip_id: @@ -153,8 +153,8 @@ async def api_update_tip( @tipjar_ext.put("/api/v1/tipjars/{tipjar_id}") async def api_update_tipjar( data: createTipJar, + tipjar_id: int, wallet: WalletTypeInfo = Depends(get_key_type), - tipjar_id: int = Query(None), ): """Update a tipjar with the data given in the request""" if tipjar_id: @@ -180,7 +180,7 @@ async def api_update_tipjar( @tipjar_ext.delete("/api/v1/tips/{tip_id}") async def api_delete_tip( - wallet: WalletTypeInfo = Depends(get_key_type), tip_id: str = Query(None) + tip_id: str, wallet: WalletTypeInfo = Depends(get_key_type) ): """Delete the tip with the given tip_id""" tip = await get_tip(tip_id) @@ -201,7 +201,8 @@ async def api_delete_tip( @tipjar_ext.delete("/api/v1/tipjars/{tipjar_id}") async def api_delete_tipjar( - wallet: WalletTypeInfo = Depends(get_key_type), tipjar_id: int = Query(None) + tipjar_id: int, + wallet: WalletTypeInfo = Depends(get_key_type) ): """Delete the tipjar with the given tipjar_id""" tipjar = await get_tipjar(tipjar_id)