refactor(api): wrap client and article responses in success object
This commit is contained in:
parent
bf4b00ed85
commit
737e340679
1 changed files with 5 additions and 2 deletions
7
api.py
7
api.py
|
|
@ -1151,7 +1151,9 @@ app.include_router(auth_router)
|
|||
async def rechercher_clients(query: Optional[str] = Query(None)):
|
||||
try:
|
||||
clients = sage_client.lister_clients(filtre=query or "")
|
||||
return [ClientDetails(**c) for c in clients]
|
||||
clients_data = [ClientDetails(**c) for c in clients]
|
||||
return {"success": True, "data": clients_data}
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur recherche clients: {e}")
|
||||
raise HTTPException(500, str(e))
|
||||
|
|
@ -1230,7 +1232,8 @@ async def ajouter_client(
|
|||
async def rechercher_articles(query: Optional[str] = Query(None)):
|
||||
try:
|
||||
articles = sage_client.lister_articles(filtre=query or "")
|
||||
return [ArticleResponse(**a) for a in articles]
|
||||
articles_data = [ArticleResponse(**a) for a in articles]
|
||||
return {"success": True, "data": articles_data}
|
||||
except Exception as e:
|
||||
logger.error(f"Erreur recherche articles: {e}")
|
||||
raise HTTPException(500, str(e))
|
||||
|
|
|
|||
Loading…
Reference in a new issue