Skip to content

Commit

Permalink
Merge pull request #7 from lnbits/revert-3-fix-fastapi
Browse files Browse the repository at this point in the history
Revert "fastapi fix"
  • Loading branch information
arcbtc authored Jul 25, 2023
2 parents 5cc7263 + 0e82794 commit d8515e7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions views_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import base64
import json
from http import HTTPStatus
from typing import Optional

import httpx
from fastapi import Depends, Query
Expand Down Expand Up @@ -45,7 +44,7 @@ async def api_get_jukeboxs(

@jukebox_ext.get("/api/v1/jukebox/spotify/cb/{juke_id}", response_class=HTMLResponse)
async def api_check_credentials_callbac(
juke_id: str,
juke_id: str = Query(None),
code: str = Query(None),
access_token: str = Query(None),
refresh_token: str = Query(None),
Expand All @@ -64,7 +63,7 @@ async def api_check_credentials_callbac(


@jukebox_ext.get("/api/v1/jukebox/{juke_id}", dependencies=[Depends(require_admin_key)])
async def api_check_credentials_check(juke_id: str):
async def api_check_credentials_check(juke_id: str = Query(None)):
jukebox = await get_jukebox(juke_id)
return jukebox

Expand All @@ -76,7 +75,7 @@ async def api_check_credentials_check(juke_id: str):
)
@jukebox_ext.put("/api/v1/jukebox/{juke_id}", status_code=HTTPStatus.OK)
async def api_create_update_jukebox(
data: CreateJukeLinkData, juke_id: Optional[str]
data: CreateJukeLinkData, juke_id: str = Query(None)
):
if juke_id:
jukebox = await update_jukebox(data, juke_id=juke_id)
Expand All @@ -88,7 +87,9 @@ async def api_create_update_jukebox(
@jukebox_ext.delete(
"/api/v1/jukebox/{juke_id}", dependencies=[Depends(require_admin_key)]
)
async def api_delete_item(juke_id: str):
async def api_delete_item(
juke_id: str = Query(None),
):
await delete_jukebox(juke_id)
# try:
# return [{**jukebox} for jukebox in await get_jukeboxs(wallet.wallet.user)]
Expand All @@ -103,8 +104,8 @@ async def api_delete_item(juke_id: str):

@jukebox_ext.get("/api/v1/jukebox/jb/playlist/{juke_id}/{sp_playlist}")
async def api_get_jukebox_song(
juke_id: str,
sp_playlist: str,
juke_id: str = Query(None),
sp_playlist: str = Query(None),
retry: bool = Query(False),
):
jukebox = await get_jukebox(juke_id)
Expand Down Expand Up @@ -188,7 +189,7 @@ async def api_get_token(juke_id):

@jukebox_ext.get("/api/v1/jukebox/jb/{juke_id}")
async def api_get_jukebox_device_check(
juke_id: str, retry: bool = Query(False)
juke_id: str = Query(None), retry: bool = Query(False)
):
jukebox = await get_jukebox(juke_id)
if not jukebox:
Expand Down Expand Up @@ -262,7 +263,7 @@ async def api_get_jukebox_invoice(juke_id, song_id):

@jukebox_ext.get("/api/v1/jukebox/jb/checkinvoice/{pay_hash}/{juke_id}")
async def api_get_jukebox_invoice_check(
pay_hash: str, juke_id: str
pay_hash: str = Query(None), juke_id: str = Query(None)
):
try:
await get_jukebox(juke_id)
Expand All @@ -281,9 +282,9 @@ async def api_get_jukebox_invoice_check(

@jukebox_ext.get("/api/v1/jukebox/jb/invoicep/{song_id}/{juke_id}/{pay_hash}")
async def api_get_jukebox_invoice_paid(
song_id: str,
juke_id: str,
pay_hash: str,
song_id: str = Query(None),
juke_id: str = Query(None),
pay_hash: str = Query(None),
retry: bool = Query(False),
):
jukebox = await get_jukebox(juke_id)
Expand Down Expand Up @@ -398,8 +399,7 @@ async def api_get_jukebox_invoice_paid(

@jukebox_ext.get("/api/v1/jukebox/jb/currently/{juke_id}")
async def api_get_jukebox_currently(
juke_id: str,
retry: bool = Query(False)
retry: bool = Query(False), juke_id: str = Query(None)
):
jukebox = await get_jukebox(juke_id)
if not jukebox:
Expand Down

0 comments on commit d8515e7

Please sign in to comment.