Rendering code refactor

This commit is contained in:
marc
2025-04-26 19:09:59 +02:00
parent 7a823a98ab
commit d132e6fd60
33 changed files with 638 additions and 188 deletions

View File

@@ -48,6 +48,12 @@ def contingut(request: Request, logged_in: auth.LoggedIn, tema_id: int):
@router.delete("/api/tema/{tema_id}")
def delete_tema(_: auth.RequireLogin, tema_id: int):
tema = temes_q.get_tema_by_id(tema_id)
if not tema:
raise HTTPException(status_code=404, detail="Could not find tune")
tema = temes_q.tema_compute_stats(tema=tema)
if tema.stats:
raise HTTPException(status_code=400, detail="Can't delete a tune that has been played in a set!")
temes_w.delete_tema(tema_id=tema_id)
files_service.clean_orphan_files()
return HTMLResponse(headers={