feat: org router endpoint cleanup

`/id/` removed from GET
Trailing `/` removed from POST and DELETE
This commit is contained in:
Chris Milne 2026-06-02 16:23:29 +01:00
parent 806bbfcbfc
commit 81a4cc6cca
3 changed files with 8 additions and 8 deletions

View file

@ -25,7 +25,7 @@ def get_org_model(db: Session, request: Request, org_id: int):
root = "/api/v1"
pre_approval_endpoints = [f"PATCH{root}/org/status", f"PATCH{root}/org/questionnaire", f"GET{root}/org/id", f"GET{root}/org/contact", f"PATCH{root}/org/contact"]
pre_approval_endpoints = [f"PATCH{root}/org/status", f"PATCH{root}/org/questionnaire", f"GET{root}/org", f"GET{root}/org/contact", f"PATCH{root}/org/contact"]
current_request = f"{request.method}{request.url.path}"
if current_request not in pre_approval_endpoints and org_model.status != OrgStatus.APPROVED:
raise AwaitingApprovalException(org_id)

View file

@ -47,7 +47,7 @@ router = APIRouter(
)
@router.get("/id",
@router.get("",
summary="Get org details by ID.",
response_model=OrgGetOrgResponse,
status_code=status.HTTP_200_OK,
@ -73,7 +73,7 @@ async def get_org_by_id(org_model: org_model_root_claim_query_dependency):
return response
@router.post("/",
@router.post("",
summary="Create new organisation.",
status_code=status.HTTP_201_CREATED,
response_model=OrgPostOrgResponse,
@ -201,7 +201,7 @@ async def add_user_to_org(db: db_dependency, org_model: org_model_root_claim_bod
return response
@router.delete("/",
@router.delete("",
summary="Delete organisation from the hub.",
status_code=status.HTTP_204_NO_CONTENT,
responses={