From 31a840d08e27d581d91f7eb18d9599a6a5c69741 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Thu, 29 Feb 2024 13:16:45 +0100 Subject: [PATCH] fix: remove trailing slash in API endpoints (#233) --- app/routers/auth.py | 6 +++--- app/routers/locations.py | 2 +- app/routers/prices.py | 4 ++-- app/routers/products.py | 2 +- app/routers/proofs.py | 2 +- app/routers/users.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/routers/auth.py b/app/routers/auth.py index bb203716..0fde1131 100644 --- a/app/routers/auth.py +++ b/app/routers/auth.py @@ -46,7 +46,7 @@ def get_current_session( ) -@auth_router.post("/") +@auth_router.post("") def authentication( form_data: Annotated[OAuth2PasswordRequestForm, Depends()], response: Response, @@ -111,7 +111,7 @@ def authentication( ) -@session_router.get("/", response_model=schemas.SessionBase) +@session_router.get("", response_model=schemas.SessionBase) def get_user_session( current_session: SessionModel = Depends(get_current_session), ): @@ -119,7 +119,7 @@ def get_user_session( return current_session -@session_router.delete("/") +@session_router.delete("") def delete_user_session( current_session: SessionModel = Depends(get_current_session), db: Session = Depends(get_db), diff --git a/app/routers/locations.py b/app/routers/locations.py index 2a5cce6c..3c2de6f0 100644 --- a/app/routers/locations.py +++ b/app/routers/locations.py @@ -10,7 +10,7 @@ router = APIRouter(prefix="/locations") -@router.get("/", response_model=Page[schemas.LocationFull]) +@router.get("", response_model=Page[schemas.LocationFull]) def get_locations( filters: schemas.LocationFilter = FilterDepends(schemas.LocationFilter), db: Session = Depends(get_db), diff --git a/app/routers/prices.py b/app/routers/prices.py index 034d9665..76540ec7 100644 --- a/app/routers/prices.py +++ b/app/routers/prices.py @@ -40,7 +40,7 @@ def price_transformer( @router.get( - "/", + "", response_model=Page[schemas.PriceFullWithRelations], ) def get_prices( @@ -56,7 +56,7 @@ def get_prices( @router.post( - "/", + "", response_model=schemas.PriceFull, status_code=status.HTTP_201_CREATED, ) diff --git a/app/routers/products.py b/app/routers/products.py index 7b251b57..aa6e3ef9 100644 --- a/app/routers/products.py +++ b/app/routers/products.py @@ -10,7 +10,7 @@ router = APIRouter(prefix="/products") -@router.get("/", response_model=Page[schemas.ProductFull]) +@router.get("", response_model=Page[schemas.ProductFull]) def get_products( filters: schemas.ProductFilter = FilterDepends(schemas.ProductFilter), db: Session = Depends(get_db), diff --git a/app/routers/proofs.py b/app/routers/proofs.py index aac33986..1a5b262d 100644 --- a/app/routers/proofs.py +++ b/app/routers/proofs.py @@ -14,7 +14,7 @@ router = APIRouter(prefix="/proofs") -@router.get("/", response_model=Page[schemas.ProofFull]) +@router.get("", response_model=Page[schemas.ProofFull]) def get_user_proofs( current_user: schemas.UserCreate = Depends(get_current_user), filters: schemas.ProofFilter = FilterDepends(schemas.ProofFilter), diff --git a/app/routers/users.py b/app/routers/users.py index b4b9776a..b974edf9 100644 --- a/app/routers/users.py +++ b/app/routers/users.py @@ -10,7 +10,7 @@ router = APIRouter(prefix="/users") -@router.get("/", response_model=Page[schemas.UserBase]) +@router.get("", response_model=Page[schemas.UserBase]) def get_users( db: Session = Depends(get_db), filters: schemas.UserFilter = FilterDepends(schemas.UserFilter),