Skip to content

Commit

Permalink
CIRCSTORE-502 add ecsRequestPhase field to request schema
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-barannyk committed Apr 19, 2024
1 parent 5390275 commit 8e44615
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
},
{
"id": "request-storage",
"version": "6.0",
"version": "6.1",
"handlers": [
{
"methods": ["GET"],
Expand Down
5 changes: 5 additions & 0 deletions ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
"type": "string",
"enum": ["Hold", "Recall", "Page"]
},
"ecsRequestPhase": {
"description": "Stage in ECS request process, absence of this field means this is a single-tenant request",
"type": "string",
"enum": ["Primary", "Secondary"]
},
"requestDate": {
"description": "Date the request was made",
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/folio/rest/api/RequestsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public void canCreateARequest(String requestLevel) throws InterruptedException,
.withProxy("Stuart", "Rebecca", "6059539205")
.withStatus(OPEN_NOT_YET_FILLED)
.withPosition(1)
.primary()
.withPickupServicePointId(pickupServicePointId)
.withTags(new Tags().withTagList(asList("new", "important")))
.create(),
Expand All @@ -177,6 +178,7 @@ public void canCreateARequest(String requestLevel) throws InterruptedException,
assertThat(representation.getInteger("position"), is(1));
assertThat(representation.getString("pickupServicePointId"), is(pickupServicePointId.toString()));
assertThat(representation.containsKey("patronComments"), is(false));
assertThat(representation.getString("ecsRequestPhase"), is("Primary"));

assertThat(representation.containsKey("item"), is(true));
JsonObject item = representation.getJsonObject("item");
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 ecsRequestPhase;

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

Expand All @@ -101,6 +103,7 @@ public JsonObject create() {
put(request, "requestExpirationDate", this.requestExpirationDate);
put(request, "holdShelfExpirationDate", this.holdShelfExpirationDate);
put(request, "pickupServicePointId", this.pickupServicePointId);
put(request, "ecsRequestPhase", this.ecsRequestPhase);

if (this.itemSummary != null) {
final JsonObject item = new JsonObject();
Expand Down Expand Up @@ -204,7 +207,8 @@ public RequestRequestBuilder withNoId() {
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.ecsRequestPhase);
}

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

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

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

public RequestRequestBuilder withProxy(
Expand Down Expand Up @@ -350,7 +357,8 @@ public RequestRequestBuilder withProxy(
this.tags,
this.patronComments,
this.holdingsRecordId,
this.searchIndex);
this.searchIndex,
this.ecsRequestPhase);
}
public RequestRequestBuilder withNoPosition() {
return withPosition(null);
Expand All @@ -375,4 +383,12 @@ private class PatronSummary {
}
}

public RequestRequestBuilder primary() {
return withEcsRequestPhase("Primary");
}

public RequestRequestBuilder secondary() {
return withEcsRequestPhase("Secondary");
}

}

0 comments on commit 8e44615

Please sign in to comment.