Skip to content

Commit

Permalink
add limited organisation list viewset
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourpeas committed May 30, 2024
1 parent 109334b commit ea2ceb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
12 changes: 12 additions & 0 deletions rcpch_nhs_organisations/hospitals/serializers/organisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4586,6 +4586,18 @@ class Meta:
depth = 1


@extend_schema_serializer(
examples=[
OpenApiExample(
"/organisation/limited/1/",
value={
"ods_code": "RGT01",
"name": "ADDENBROOKE'S HOSPITAL",
},
response_only=True,
)
]
)
class OrganisationNoParentsSerializer(serializers.ModelSerializer):
# used to serialize all child organisations in the TrustSerializer
# returns only ods_code and name
Expand Down
11 changes: 6 additions & 5 deletions rcpch_nhs_organisations/hospitals/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@

router = routers.DefaultRouter()

# returns a list of organisations and their nested parent details (without boundary data)
router.register(r"organisations", viewset=OrganisationViewSet, basename="organisation")

# returns a list of organisations by name and ods code
# returns a limited list of organisations by name and ods code
router.register(
r"organisations/limited",
viewset=OrganisationLimitedViewSet,
basename="organisation",
basename="organisation-limited",
)

# returns a list of organisations and their nested parent details (without boundary data)
router.register(r"organisations", viewset=OrganisationViewSet, basename="organisation")


# returns a list of trusts and their details with their nested child organisations (ods_code and name only)
router.register(
r"trusts",
Expand Down
1 change: 1 addition & 0 deletions rcpch_nhs_organisations/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"127.0.0.1",
"localhost",
"0.0.0.0",
"rcpch-nhs-organisations.localhost",
]

# Application definition
Expand Down

0 comments on commit ea2ceb7

Please sign in to comment.