Private
Public Access
addet test set
This commit is contained in:
1 parent
d370f992ce
commit
b0f35bf3cc
21 files changed
+1796
-183
No files matched your search
@@ -126,6 +126,27 @@ def create_app(demo: bool = False, state_dir: Path | None = None) -> FastAPI:
|
||||
except sqlite3.Error as exc:
|
||||
raise HTTPException(status_code=503, detail=f"Datenbank nicht verfügbar: {exc}") from exc
|
||||
|
||||
@app.get("/api/events/{event_id}/image")
|
||||
async def event_image(event_id: int):
|
||||
try:
|
||||
content = events.image_path(event_id).read_bytes()
|
||||
except (KeyError, FileNotFoundError) as exc:
|
||||
raise HTTPException(status_code=404, detail="Bild nicht vorhanden") from exc
|
||||
except (OSError, sqlite3.Error) as exc:
|
||||
raise HTTPException(status_code=503, detail="Bild nicht verfügbar") from exc
|
||||
return Response(content, media_type="image/jpeg", headers={
|
||||
"Cache-Control": "no-store", "X-Content-Type-Options": "nosniff",
|
||||
})
|
||||
|
||||
@app.delete("/api/events/{event_id}/image", dependencies=[Depends(require_ui)])
|
||||
async def delete_event_image(event_id: int):
|
||||
try:
|
||||
return {"deleted": events.delete_image(event_id)}
|
||||
except KeyError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc.args[0])) from exc
|
||||
except (OSError, sqlite3.Error) as exc:
|
||||
raise HTTPException(status_code=503, detail="Bild konnte nicht gelöscht werden") from exc
|
||||
|
||||
@app.get("/api/profiles")
|
||||
async def list_profiles():
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user