Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIRC-2141 Add itemLocationCode to request object schema #491

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@
"description": "Request fields used for search",
"type": "object",
"$ref": "request-search-index.json"
},
"itemLocationCode": {
JanisSaldabols marked this conversation as resolved.
Show resolved Hide resolved
"description": "Allow specifying item location when creating title-level requests",
"type": "string"
}
},
"additionalProperties": false,
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/org/folio/rest/api/RequestsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public void canCreateARequest(String requestLevel) throws InterruptedException,
.withPosition(1)
.withPickupServicePointId(pickupServicePointId)
.withTags(new Tags().withTagList(asList("new", "important")))
.withItemLocationCode("CN/P1")
.create(),
requestStorageUrl())
.getJson();
Expand Down Expand Up @@ -228,6 +229,8 @@ public void canCreateARequest(String requestLevel) throws InterruptedException,
assertThat(tagsRepresentation.containsKey("tagList"), is(true));
assertThat(tagsRepresentation.getJsonArray("tagList"), contains("new", "important"));

assertThat(representation.getString("itemLocationCode"), is("CN/P1"));

assertCreateEventForRequest(representation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class RequestRequestBuilder extends JsonBuilder {
private final String patronComments;
private final UUID holdingsRecordId;
private final SearchIndex searchIndex;
private final String itemLocationCode;

public RequestRequestBuilder() {
this(UUID.randomUUID(),
Expand Down Expand Up @@ -79,6 +80,7 @@ public RequestRequestBuilder() {
null,
null,
UUID.randomUUID(),
null,
null);
}

Expand Down Expand Up @@ -162,6 +164,10 @@ public JsonObject create() {
put(request, "searchIndex", JsonObject.mapFrom(searchIndex));
}

if (itemLocationCode != null) {
put(request, "itemLocationCode", this.itemLocationCode);
}

return request;
}

Expand Down Expand Up @@ -204,7 +210,8 @@ public RequestRequestBuilder withNoId() {
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder toHoldShelf() {
Expand Down Expand Up @@ -247,7 +254,8 @@ public RequestRequestBuilder withItem(RequestItemSummary item) {
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withRequester(
Expand Down Expand Up @@ -282,7 +290,8 @@ public RequestRequestBuilder withRequester(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withRequester(
Expand Down Expand Up @@ -316,7 +325,8 @@ public RequestRequestBuilder withRequester(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}

public RequestRequestBuilder withProxy(
Expand Down Expand Up @@ -350,7 +360,8 @@ public RequestRequestBuilder withProxy(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.itemLocationCode);
}
public RequestRequestBuilder withNoPosition() {
return withPosition(null);
Expand Down