syntax refactoring up to diagonalley

This commit is contained in:
Tiago vasconcelos
2021-08-23 10:18:52 +01:00
parent e03eb3c82b
commit 83a9dc2a3e
3 changed files with 87 additions and 84 deletions
+10 -10
View File
@@ -40,7 +40,7 @@ async def api_get_jukeboxs():
##################SPOTIFY AUTH#####################
@jukebox_ext.get("/api/v1/jukebox/spotify/cb/<juke_id>")
@jukebox_ext.get("/api/v1/jukebox/spotify/cb/{juke_id}")
async def api_check_credentials_callbac(juke_id):
sp_code = ""
sp_access_token = ""
@@ -69,7 +69,7 @@ async def api_check_credentials_callbac(juke_id):
return "<h1>Success!</h1><h2>You can close this window</h2>"
@jukebox_ext.get("/api/v1/jukebox/<juke_id>")
@jukebox_ext.get("/api/v1/jukebox/{juke_id}")
@api_check_wallet_key("admin")
async def api_check_credentials_check(juke_id):
jukebox = await get_jukebox(juke_id)
@@ -89,7 +89,7 @@ class CreateData(BaseModel):
price: Optional[str] = None
@jukebox_ext.post("/api/v1/jukebox/")
@jukebox_ext.put("/api/v1/jukebox/<juke_id>")
@jukebox_ext.put("/api/v1/jukebox/{juke_id}")
@api_check_wallet_key("admin")
async def api_create_update_jukebox(data: CreateData, juke_id=None):
if juke_id:
@@ -100,7 +100,7 @@ async def api_create_update_jukebox(data: CreateData, juke_id=None):
return jukebox._asdict(), HTTPStatus.CREATED
@jukebox_ext.delete("/api/v1/jukebox/<juke_id>")
@jukebox_ext.delete("/api/v1/jukebox/{juke_id}")
@api_check_wallet_key("admin")
async def api_delete_item(juke_id):
await delete_jukebox(juke_id)
@@ -120,7 +120,7 @@ async def api_delete_item(juke_id):
@jukebox_ext.get(
"/api/v1/jukebox/jb/playlist/<juke_id>/<sp_playlist>"
"/api/v1/jukebox/jb/playlist/{juke_id}/{sp_playlist}"
)
async def api_get_jukebox_song(juke_id, sp_playlist, retry=False):
try:
@@ -210,7 +210,7 @@ async def api_get_token(juke_id):
######CHECK DEVICE
@jukebox_ext.get("/api/v1/jukebox/jb/<juke_id>")
@jukebox_ext.get("/api/v1/jukebox/jb/{juke_id}")
async def api_get_jukebox_device_check(juke_id, retry=False):
try:
jukebox = await get_jukebox(juke_id)
@@ -255,7 +255,7 @@ async def api_get_jukebox_device_check(juke_id, retry=False):
######GET INVOICE STUFF
@jukebox_ext.get("/api/v1/jukebox/jb/invoice/<juke_id>/<song_id>")
@jukebox_ext.get("/api/v1/jukebox/jb/invoice/{juke_id}/{song_id}")
async def api_get_jukebox_invoice(juke_id, song_id):
try:
jukebox = await get_jukebox(juke_id)
@@ -295,7 +295,7 @@ async def api_get_jukebox_invoice(juke_id, song_id):
@jukebox_ext.get(
"/api/v1/jukebox/jb/checkinvoice/<pay_hash>/<juke_id>"
"/api/v1/jukebox/jb/checkinvoice/{pay_hash}/{juke_id}"
)
async def api_get_jukebox_invoice_check(pay_hash, juke_id):
try:
@@ -320,7 +320,7 @@ async def api_get_jukebox_invoice_check(pay_hash, juke_id):
@jukebox_ext.get(
"/api/v1/jukebox/jb/invoicep/<song_id>/<juke_id>/<pay_hash>"
"/api/v1/jukebox/jb/invoicep/{song_id}/{juke_id}/{pay_hash}"
)
async def api_get_jukebox_invoice_paid(song_id, juke_id, pay_hash, retry=False):
try:
@@ -437,7 +437,7 @@ async def api_get_jukebox_invoice_paid(song_id, juke_id, pay_hash, retry=False):
############################GET TRACKS
@jukebox_ext.get("/api/v1/jukebox/jb/currently/<juke_id>")
@jukebox_ext.get("/api/v1/jukebox/jb/currently/{juke_id}")
async def api_get_jukebox_currently(juke_id, retry=False):
try:
jukebox = await get_jukebox(juke_id)