feat: get/patch contact includes org info

Resolves #19
This commit is contained in:
Chris Milne 2026-06-03 09:45:48 +01:00
parent 8a9f03ee0b
commit af680dbc38
2 changed files with 10 additions and 3 deletions

View file

@ -39,7 +39,7 @@ from src.organisation.schemas import OrgPostOrgRequest, OrgPatchQuestionnaireReq
OrgPatchContactRequest, \
OrgPostUserRequest, OrgGetUserResponse, OrgGetContactResponse, OrgGetOrgResponse, OrgPatchRootRequest, \
OrgGetGroupResponse, OrgDeleteUserRequest, OrgDeleteOrgRequest, OrgPostOrgResponse, OrgPatchQuestionnaireResponse, \
OrgPatchStatusResponse, OrgPostUserResponse, OrgPatchRootResponse, Questionnaire
OrgPatchStatusResponse, OrgPostUserResponse, OrgPatchRootResponse, Questionnaire, OrgPatchContactResponse
router = APIRouter(
prefix="/org",
@ -319,7 +319,7 @@ async def get_contact(org_model: org_model_root_claim_query_dependency, contact_
@router.patch("/contact",
summary="Update contact for organisation.",
status_code=status.HTTP_200_OK,
response_model=OrgGetContactResponse,
response_model=OrgPatchContactResponse,
responses={
status.HTTP_200_OK: {"description": "Successfully updated contact."},
status.HTTP_422_UNPROCESSABLE_CONTENT: {"description": "Invalid data in request."},
@ -357,4 +357,4 @@ async def update_contact(db: db_dependency, org_model: org_model_root_claim_body
db.commit()
return {"contact": contact_response}
return {"contact": contact_response, "organisation": org_model}

View file

@ -97,6 +97,13 @@ class OrgGetContactResponse(CustomBaseModel):
model_config = ConfigDict(from_attributes=True, extra="ignore")
contact: ContactModel
organisation: OrgSchema
class OrgPatchContactResponse(CustomBaseModel):
model_config = ConfigDict(from_attributes=True, extra="ignore")
contact: ContactModel
organisation: OrgSchema
class OrgGetOrgResponse(CustomBaseModel):
name: str