refactor(api): change router to app for article endpoints

This commit is contained in:
Fanilo-Nantenaina 2025-12-10 17:04:59 +03:00
parent 428093306a
commit a133172a0b

8
api.py
View file

@ -1086,7 +1086,7 @@ async def rechercher_articles(query: Optional[str] = Query(None)):
logger.error(f"Erreur recherche articles: {e}") logger.error(f"Erreur recherche articles: {e}")
raise HTTPException(500, str(e)) raise HTTPException(500, str(e))
@router.post("/articles", status_code=status.HTTP_201_CREATED, tags=["Articles"]) @app.post("/articles", status_code=status.HTTP_201_CREATED, tags=["Articles"])
def creer_article(article: ArticleCreateDTO): def creer_article(article: ArticleCreateDTO):
""" """
Création d'un article dans Sage Création d'un article dans Sage
@ -1116,7 +1116,7 @@ def creer_article(article: ArticleCreateDTO):
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e)) raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e))
@router.put("/articles/{reference}", tags=["Articles"]) @app.put("/articles/{reference}", tags=["Articles"])
def modifier_article(reference: str, article: ArticleUpdateDTO): def modifier_article(reference: str, article: ArticleUpdateDTO):
""" """
Modification d'un article dans Sage Modification d'un article dans Sage
@ -1164,7 +1164,7 @@ def modifier_article(reference: str, article: ArticleUpdateDTO):
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e)) raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e))
@router.get("/articles/{reference}", tags=["Articles"]) @app.get("/articles/{reference}", tags=["Articles"])
def lire_article(reference: str): def lire_article(reference: str):
""" """
📄 Lecture d'un article par référence 📄 Lecture d'un article par référence
@ -1189,7 +1189,7 @@ def lire_article(reference: str):
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e)) raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, str(e))
@router.get("/articles/all") @app.get("/articles/all")
def lister_articles(filtre: str = ""): def lister_articles(filtre: str = ""):
""" """
📋 Liste tous les articles avec filtre optionnel 📋 Liste tous les articles avec filtre optionnel