From df5ed76ec678891731400f041ce2f5236ffc1e95 Mon Sep 17 00:00:00 2001 From: Fanilo-Nantenaina Date: Fri, 5 Dec 2025 14:44:53 +0300 Subject: [PATCH] feat(api): add endpoint to read order with its lines --- api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api.py b/api.py index 6a0dc37..81e7e3a 100644 --- a/api.py +++ b/api.py @@ -550,6 +550,20 @@ async def changer_statut_devis(id: str, nouveau_statut: int = Query(..., ge=0, l # ENDPOINTS - US-A2 (WORKFLOW SANS RESSAISIE) # ===================================================== +@app.get("/commandes/{id}", tags=["US-A2"]) +async def lire_commande(id: str): + """📄 Lecture d'une commande avec ses lignes""" + try: + commande = sage_client.lire_document(id, TypeDocument.BON_COMMANDE) + if not commande: + raise HTTPException(404, f"Commande {id} introuvable") + return commande + except HTTPException: + raise + except Exception as e: + logger.error(f"Erreur lecture commande: {e}") + raise HTTPException(500, str(e)) + @app.get("/commandes", tags=["US-A2"]) async def lister_commandes(