From 89ff28d52cb2bbe6b9c971ef167b3201230bad04 Mon Sep 17 00:00:00 2001 From: lincmba Date: Fri, 5 Apr 2024 14:03:36 +0300 Subject: [PATCH] Update documentation. --- README.md | 13 +++++++++++++ .../fhir/gateway/plugins/SyncAccessDecision.java | 4 ++-- .../LocationHierarchyEndpointHelperTest.java | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b9b7c77..8baf46a 100755 --- a/README.md +++ b/README.md @@ -308,6 +308,19 @@ Example: [GET] /List?_id=&_count=&_page=&_sort= ``` +##### LocationHierarchy list mode + +The LocationHierarchy endpoint supports two response formats: tree and list. By +default, the response format remains a tree, providing hierarchical location +data. In addition, clients can request the endpoint to return location resources +in a flat list format by providing a request parameter `mode=list`. + +Example: + +``` +[GET] /LocationHierarchy?identifier=&mode=list&_count=&_page=&_sort= +``` + #### Important Note: Developers, please update your client applications accordingly to accommodate diff --git a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java index 42662c7..7606e43 100755 --- a/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java +++ b/plugins/src/main/java/org/smartregister/fhir/gateway/plugins/SyncAccessDecision.java @@ -372,8 +372,8 @@ public static Bundle addPaginationLinks( Map parameters) { resultBundle.setTotal(totalEntries); - // add pagination links - int nextPage = page < ((float)totalEntries / count) ? page + 1 : 0; // 0 indicates no next page + int nextPage = + page < ((float) totalEntries / count) ? page + 1 : 0; // 0 indicates no next page int prevPage = page > 1 ? page - 1 : 0; // 0 indicates no previous page Bundle.BundleLinkComponent selfLink = new Bundle.BundleLinkComponent(); diff --git a/plugins/src/test/java/org/smartregister/fhir/gateway/plugins/LocationHierarchyEndpointHelperTest.java b/plugins/src/test/java/org/smartregister/fhir/gateway/plugins/LocationHierarchyEndpointHelperTest.java index 5efd449..99d03bf 100644 --- a/plugins/src/test/java/org/smartregister/fhir/gateway/plugins/LocationHierarchyEndpointHelperTest.java +++ b/plugins/src/test/java/org/smartregister/fhir/gateway/plugins/LocationHierarchyEndpointHelperTest.java @@ -103,8 +103,8 @@ public void testGetPaginatedLocationsPaginatesLocations() { "http://test:8080/LocationHierarchy?identifier=12345&_page=2&_count=2", resultBundle.getLink("self").getUrl()); Assert.assertEquals( - "http://test:8080/LocationHierarchy?identifier=12345&_page=3&_count=2", - resultBundle.getLink("next").getUrl()); + "http://test:8080/LocationHierarchy?identifier=12345&_page=3&_count=2", + resultBundle.getLink("next").getUrl()); } private Bundle getLocationBundle() {