feat(api): add endpoint to read order with its lines

This commit is contained in:
Fanilo-Nantenaina 2025-12-05 14:44:53 +03:00
parent 588ea6c4f4
commit df5ed76ec6

14
api.py
View file

@ -550,6 +550,20 @@ async def changer_statut_devis(id: str, nouveau_statut: int = Query(..., ge=0, l
# ENDPOINTS - US-A2 (WORKFLOW SANS RESSAISIE) # 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"]) @app.get("/commandes", tags=["US-A2"])
async def lister_commandes( async def lister_commandes(