From 2ea8d87425b85015d1efd14eeb6675374dbfa8df Mon Sep 17 00:00:00 2001 From: SinghAdes <90304030+SinghAdes@users.noreply.github.com> Date: Fri, 22 Dec 2023 00:32:47 +0530 Subject: [PATCH] [CIRC-1988-1]-Added fix (#1414) * [CIRC-1988-1]-Added fix * [CIRC-1988-1]-Added fix --- .../infrastructure/storage/inventory/ItemRepository.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java index de153ba0e2..5a0fc559ae 100644 --- a/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java +++ b/src/main/java/org/folio/circulation/infrastructure/storage/inventory/ItemRepository.java @@ -147,6 +147,7 @@ public CompletableFuture> fetchByBarcode(String barcode) { return fetchItemByBarcode(barcode, createItemFinder()) .thenComposeAsync(itemResult -> itemResult.after(when(item -> ofAsync(item::isNotFound), item -> fetchItemByBarcode(barcode, createCirculationItemFinder()) + .thenApply(r -> r.mapFailure(failure -> Result.succeeded(item))) , item -> completedFuture(itemResult)))) .thenComposeAsync(this::fetchItemRelatedRecords); } @@ -276,6 +277,7 @@ private CompletableFuture> fetchItem(String itemId) { } public CompletableFuture> fetchItemAsJson(String itemId) { + return SingleRecordFetcher.jsonOrNull(itemsClient, "item") .fetch(itemId) .thenApply(mapResult(identityMap::add));