refactor(enterprise): change siren parameter from Query to Path and corrected deprecated "regex"

This commit is contained in:
Fanilo-Nantenaina 2026-01-13 18:24:10 +03:00
parent e7003d4059
commit d5273a0786

View file

@ -1,4 +1,4 @@
from fastapi import APIRouter, HTTPException, Query from fastapi import APIRouter, HTTPException, Query, Path
import httpx import httpx
import logging import logging
from datetime import datetime from datetime import datetime
@ -55,11 +55,11 @@ async def rechercher_entreprise(
@router.get("/siren/{siren}", response_model=EntrepriseSearch) @router.get("/siren/{siren}", response_model=EntrepriseSearch)
async def lire_entreprise_par_siren( async def lire_entreprise_par_siren(
siren: str = Query( siren: str = Path(
..., ...,
min_length=9, min_length=9,
max_length=9, max_length=9,
regex=r"^\d{9}$", pattern=r"^\d{9}$",
description="Numéro SIREN (9 chiffres)", description="Numéro SIREN (9 chiffres)",
), ),
): ):
@ -106,11 +106,11 @@ async def lire_entreprise_par_siren(
@router.get("/tva/{siren}") @router.get("/tva/{siren}")
async def calculer_tva( async def calculer_tva(
siren: str = Query( siren: str = Path(
..., ...,
min_length=9, min_length=9,
max_length=9, max_length=9,
regex=r"^\d{9}$", pattern=r"^\d{9}$",
description="Numéro SIREN (9 chiffres)", description="Numéro SIREN (9 chiffres)",
), ),
): ):