diff --git a/app/main.py b/app/main.py index c5346555ff4c338f87081b2fd69d5bc89aa9e3ac..c268b10492d0cf395022c10e282b288c6bc7ca85 100644 --- a/app/main.py +++ b/app/main.py @@ -173,6 +173,18 @@ def download_certificate(hash: str, db: Session = Depends(get_db)): return {"message": "Result not ready."} +@app.post("/result/image") +def download_image(hash: str, db: Session = Depends(get_db)): + # ready, not ready, ongoing + session = crud.get_cocal_session_by_hash(db, hash) + + if session.result_state == "ready": + filepath = Path(".").joinpath("sessions", session.hash, "transfer_behaviour.png") + return FileResponse(filepath, filename=filepath.name) + else: + return {"message": "Result not ready."} + + ######################################################################################## ######### offline Swagger UI ########################################################### ########################################################################################