Skip to content

Commit

Permalink
msearch-707: adjust poc after marge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mukhiddin-yusuf committed Apr 29, 2024
1 parent 399ee83 commit 48ce00c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"methods": [
"GET"
],
"pathPattern": "/search/consortium/item",
"pathPattern": "/search/consortium/item/{id}",
"permissionsRequired": [
"consortium-search.items.collection.get"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.folio.search.controller;

import static org.apache.commons.collections4.CollectionUtils.isEmpty;

import java.util.UUID;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections4.CollectionUtils;
import org.folio.search.domain.dto.ConsortiumHolding;
import org.folio.search.domain.dto.ConsortiumHoldingCollection;
import org.folio.search.domain.dto.ConsortiumItem;
import org.folio.search.domain.dto.ConsortiumItemCollection;
import org.folio.search.domain.dto.Instance;
import org.folio.search.domain.dto.ConsortiumLocationCollection;
import org.folio.search.domain.dto.Instance;
import org.folio.search.domain.dto.SortOrder;
import org.folio.search.exception.RequestValidationException;
import org.folio.search.model.service.ConsortiumSearchContext;
Expand Down Expand Up @@ -65,8 +66,7 @@ public ResponseEntity<ConsortiumHolding> getConsortiumHolding(UUID id, String te
var searchRequest = CqlSearchRequest.of(Instance.class, tenant, query, 1, 0, true);
var result = searchService.search(searchRequest);

if (CollectionUtils.isEmpty(result.getRecords())
|| CollectionUtils.isEmpty(result.getRecords().iterator().next().getHoldings())) {
if (isEmpty(result.getRecords()) || isEmpty(result.getRecords().iterator().next().getHoldings())) {
return ResponseEntity.ok(new ConsortiumHolding());
}

Expand Down Expand Up @@ -120,10 +120,10 @@ public ResponseEntity<ConsortiumItem> getConsortiumItem(UUID itemId, String tena
var searchRequest = CqlSearchRequest.of(Instance.class, tenant, query, 1, 0, true);
var result = searchService.search(searchRequest);

if (CollectionUtils.isEmpty(result.getRecords())
|| CollectionUtils.isEmpty(result.getRecords().iterator().next().getItems())) {
if (isEmpty(result.getRecords()) || isEmpty(result.getRecords().iterator().next().getItems())) {
return ResponseEntity.ok(new ConsortiumItem());
}

var instance = result.getRecords().iterator().next();
var item = instance.getItems().iterator().next();
return ResponseEntity.ok(new ConsortiumItem()
Expand Down
18 changes: 11 additions & 7 deletions src/main/resources/swagger.api/mod-search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/consortiumHolding'
$ref: 'schemas/entity/consortiumHolding.yaml'
'400':
$ref: '#/components/responses/badRequestResponse'
$ref: 'responses/badRequestResponse.yaml'
'500':
$ref: '#/components/responses/internalServerErrorResponse'
$ref: 'responses/internalServerErrorResponse.yaml'

/search/consortium/item/{id}:
get:

Check failure on line 105 in src/main/resources/swagger.api/mod-search.yaml

View workflow job for this annotation

GitHub Actions / Lint (push)

docs-summary

No summary provided for get.summary
Expand All @@ -120,11 +120,11 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/consortiumItem'
$ref: 'schemas/entity/consortiumItem.yaml'
'400':
$ref: '#/components/responses/badRequestResponse'
$ref: 'responses/badRequestResponse.yaml'
'500':
$ref: '#/components/responses/internalServerErrorResponse'
$ref: 'responses/internalServerErrorResponse.yaml'

/search/index/indices:
$ref: 'paths/search-index/search-index-indices.yaml'
Expand Down Expand Up @@ -174,6 +174,10 @@ paths:
/browse/config/{browseType}/{browseOptionId}:
$ref: 'paths/browse-config/browse-type-browse-option-id.yaml'


components:
schemas:
uuid:

Check warning on line 179 in src/main/resources/swagger.api/mod-search.yaml

View workflow job for this annotation

GitHub Actions / Lint (push)

docs-descriptions

"uuid.description" property must be truthy.
type: string
format: uuid


0 comments on commit 48ce00c

Please sign in to comment.