refactor(api): replace hardcoded document types with TypeDocumentSQL enum
This commit is contained in:
parent
da4d43dcf7
commit
19ea145bbb
1 changed files with 4 additions and 4 deletions
8
api.py
8
api.py
|
|
@ -1996,7 +1996,7 @@ async def modifier_commande(
|
||||||
try:
|
try:
|
||||||
# Vérifier que la commande existe
|
# Vérifier que la commande existe
|
||||||
commande_existante = sage_client.lire_document(
|
commande_existante = sage_client.lire_document(
|
||||||
id, settings.SAGE_TYPE_BON_COMMANDE
|
id, TypeDocumentSQL.BON_COMMANDE
|
||||||
)
|
)
|
||||||
|
|
||||||
if not commande_existante:
|
if not commande_existante:
|
||||||
|
|
@ -2079,7 +2079,7 @@ async def lister_devis(
|
||||||
@app.get("/devis/{id}", tags=["Devis"])
|
@app.get("/devis/{id}", tags=["Devis"])
|
||||||
async def lire_devis(id: str):
|
async def lire_devis(id: str):
|
||||||
try:
|
try:
|
||||||
devis = sage_client.lire_document(id, TypeDocumentSQL.DEVIS)
|
devis = sage_client.lire_devis(id)
|
||||||
|
|
||||||
if not devis:
|
if not devis:
|
||||||
raise HTTPException(404, f"Devis {id} introuvable")
|
raise HTTPException(404, f"Devis {id} introuvable")
|
||||||
|
|
@ -3190,7 +3190,7 @@ async def modifier_facture(
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
# Vérifier que la facture existe
|
# Vérifier que la facture existe
|
||||||
facture_existante = sage_client.lire_document(id, settings.SAGE_TYPE_FACTURE)
|
facture_existante = sage_client.lire_document(id, TypeDocumentSQL.FACTURE)
|
||||||
|
|
||||||
if not facture_existante:
|
if not facture_existante:
|
||||||
raise HTTPException(404, f"Facture {id} introuvable")
|
raise HTTPException(404, f"Facture {id} introuvable")
|
||||||
|
|
@ -3281,7 +3281,7 @@ async def relancer_facture(
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
# Lire facture via gateway Windows
|
# Lire facture via gateway Windows
|
||||||
facture = sage_client.lire_document(id, TypeDocument.FACTURE)
|
facture = sage_client.lire_document(id, TypeDocumentSQL.FACTURE)
|
||||||
if not facture:
|
if not facture:
|
||||||
raise HTTPException(404, f"Facture {id} introuvable")
|
raise HTTPException(404, f"Facture {id} introuvable")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue