fix: corrected use of path param
Previously used `param: int = Path()` this worked but was incorrect. Correct usage is `param: Annotated[int, Path()]`
This commit is contained in:
parent
2b8296d622
commit
6f4556a44b
4 changed files with 24 additions and 16 deletions
|
|
@ -5,6 +5,8 @@ Endpoints:
|
|||
- List: Description
|
||||
- Endpoints: Description
|
||||
"""
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.params import Path
|
||||
from sqlalchemy.sql import exists
|
||||
|
|
@ -29,7 +31,7 @@ router = APIRouter(
|
|||
|
||||
|
||||
@router.get("/{org_id}/contact/{contact_type}", response_model=OrgContactGetResponse)
|
||||
async def get_contact(db: db_dependency, user: claims_dependency, is_org_admin: org_user_dependency, contact_type: ContactType, org_id: int = Path(gt=0)):
|
||||
async def get_contact(db: db_dependency, user: claims_dependency, is_admin: org_user_dependency, contact_type: ContactType, org_id: Annotated[int, Path(gt=0)]):
|
||||
org_model = db.query(Org).filter(Org.id == org_id).first()
|
||||
if org_model is None:
|
||||
raise HTTPException(status_code=404, detail="Organisation not found")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue