From 6b35dad1d249646518e5952f32a783815a042fd4 Mon Sep 17 00:00:00 2001 From: PK Jacob Date: Tue, 21 Jan 2025 12:23:50 -0500 Subject: [PATCH] MODLD-604: Remove unwanted x-okapi-tenant parameter from controller methods --- .../AuthorityAssignmentController.java | 2 +- .../data/controller/ReindexingController.java | 2 +- .../data/controller/ResourceController.java | 12 ++++++------ .../controller/ResourceGraphController.java | 2 +- .../resources/swagger.api/mod-linked-data.yaml | 17 ----------------- .../data/controller/ResourceControllerTest.java | 4 +--- 6 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/folio/linked/data/controller/AuthorityAssignmentController.java b/src/main/java/org/folio/linked/data/controller/AuthorityAssignmentController.java index c4518ed5..4c1088fd 100644 --- a/src/main/java/org/folio/linked/data/controller/AuthorityAssignmentController.java +++ b/src/main/java/org/folio/linked/data/controller/AuthorityAssignmentController.java @@ -17,7 +17,7 @@ public class AuthorityAssignmentController implements AuthorityApi { private final ResourceMarcAuthorityService resourceMarcAuthorityService; @Override - public ResponseEntity authorityAssignmentCheck(String okapiTenant, AssignmentCheckDto dto) { + public ResponseEntity authorityAssignmentCheck(AssignmentCheckDto dto) { return ok(String.valueOf( resourceMarcAuthorityService.isMarcAuthorityCompatibleWithTarget( dto.getRawMarc(), diff --git a/src/main/java/org/folio/linked/data/controller/ReindexingController.java b/src/main/java/org/folio/linked/data/controller/ReindexingController.java index 7f1f4142..105c5222 100644 --- a/src/main/java/org/folio/linked/data/controller/ReindexingController.java +++ b/src/main/java/org/folio/linked/data/controller/ReindexingController.java @@ -19,7 +19,7 @@ public class ReindexingController implements ReindexApi { private final ReindexService reIndexService; @Override - public ResponseEntity reindex(String okapiTenant, Boolean full) { + public ResponseEntity reindex(Boolean full) { reIndexService.reindexWorks(full); return ResponseEntity.noContent().build(); } diff --git a/src/main/java/org/folio/linked/data/controller/ResourceController.java b/src/main/java/org/folio/linked/data/controller/ResourceController.java index be7e189a..0feb3b15 100644 --- a/src/main/java/org/folio/linked/data/controller/ResourceController.java +++ b/src/main/java/org/folio/linked/data/controller/ResourceController.java @@ -27,17 +27,17 @@ public class ResourceController implements ResourceApi { private final ResourceMarcBibService resourceMarcService; @Override - public ResponseEntity createResource(String okapiTenant, @Valid ResourceRequestDto resourceDto) { + public ResponseEntity createResource(@Valid ResourceRequestDto resourceDto) { return ResponseEntity.ok(resourceService.createResource(resourceDto)); } @Override - public ResponseEntity getResourceById(Long id, String okapiTenant) { + public ResponseEntity getResourceById(Long id) { return ResponseEntity.ok(resourceService.getResourceById(id)); } @Override - public ResponseEntity getResourceIdByResourceInventoryId(String inventoryId, String okapiTenant) { + public ResponseEntity getResourceIdByResourceInventoryId(String inventoryId) { return ResponseEntity.ok(resourceService.getResourceIdByInventoryId(inventoryId)); } @@ -59,19 +59,19 @@ public ResponseEntity importMarcRecord(String inventoryId) { } @Override - public ResponseEntity updateResource(Long id, String okapiTenant, + public ResponseEntity updateResource(Long id, @Valid ResourceRequestDto resourceDto) { return ResponseEntity.ok(resourceService.updateResource(id, resourceDto)); } @Override - public ResponseEntity deleteResource(Long id, String okapiTenant) { + public ResponseEntity deleteResource(Long id) { resourceService.deleteResource(id); return ResponseEntity.noContent().build(); } @Override - public ResponseEntity getResourceMarcViewById(Long id, String okapiTenant) { + public ResponseEntity getResourceMarcViewById(Long id) { return ResponseEntity.ok(resourceMarcService.getResourceMarcView(id)); } diff --git a/src/main/java/org/folio/linked/data/controller/ResourceGraphController.java b/src/main/java/org/folio/linked/data/controller/ResourceGraphController.java index 03ff0248..e6a4d6d0 100644 --- a/src/main/java/org/folio/linked/data/controller/ResourceGraphController.java +++ b/src/main/java/org/folio/linked/data/controller/ResourceGraphController.java @@ -16,7 +16,7 @@ public class ResourceGraphController implements GraphApi { private final ResourceGraphService resourceGraphService; @Override - public ResponseEntity getResourceGraphById(Long id, String okapiTenant) { + public ResponseEntity getResourceGraphById(Long id) { return ResponseEntity.ok(resourceGraphService.getResourceGraph(id)); } } diff --git a/src/main/resources/swagger.api/mod-linked-data.yaml b/src/main/resources/swagger.api/mod-linked-data.yaml index 2518d7f4..dddc268a 100644 --- a/src/main/resources/swagger.api/mod-linked-data.yaml +++ b/src/main/resources/swagger.api/mod-linked-data.yaml @@ -12,7 +12,6 @@ paths: - reindex description: Start the process of reindexing of resources in the database parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/full' responses: '204': @@ -28,8 +27,6 @@ paths: tags: - resource description: Create a Resource - parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' requestBody: content: application/json: @@ -54,7 +51,6 @@ paths: - resource description: Get a resource by id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/id' responses: '200': @@ -75,7 +71,6 @@ paths: - resource description: Update a resource by id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/id' requestBody: content: @@ -102,7 +97,6 @@ paths: - resource description: Delete a resource by id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/id' responses: '204': @@ -119,7 +113,6 @@ paths: - resource description: Get a marc view of resource by id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/id' responses: '200': @@ -142,7 +135,6 @@ paths: - resource description: Get id of a resource by its inventory id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/inventoryId' responses: '200': @@ -243,7 +235,6 @@ paths: - graph description: Get a resource graph by id parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' - $ref: '#/components/parameters/id' responses: '200': @@ -265,8 +256,6 @@ paths: tags: - authority description: Checks if authority can be assigned to work - parameters: - - $ref: '#/components/parameters/x-okapi-tenant-header' requestBody: content: application/json: @@ -302,12 +291,6 @@ components: description: Linked Data resource inventory id schema: type: string - x-okapi-tenant-header: - name: x-okapi-tenant - in: header - description: X-Okapi-Tenant header value - schema: - type: string full: name: full in: query diff --git a/src/test/java/org/folio/linked/data/controller/ResourceControllerTest.java b/src/test/java/org/folio/linked/data/controller/ResourceControllerTest.java index 70764adf..52c16b7c 100644 --- a/src/test/java/org/folio/linked/data/controller/ResourceControllerTest.java +++ b/src/test/java/org/folio/linked/data/controller/ResourceControllerTest.java @@ -17,8 +17,6 @@ @ExtendWith(MockitoExtension.class) class ResourceControllerTest { - private static final String OKAPI_TENANT = "okapiTenant"; - @InjectMocks ResourceController resourceController; @Mock @@ -37,7 +35,7 @@ void getResourceMarcViewById_shouldReturnOkResponse() { .thenReturn(expectedDto); //when - var response = resourceController.getResourceMarcViewById(id, OKAPI_TENANT); + var response = resourceController.getResourceMarcViewById(id); //then assertThat(response)