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-2136 set new location on check-in response and pick slip context. #5

Merged
merged 18 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6bdf704
add ID dev workflows
funkymalc Aug 22, 2024
f56ee44
Enable verbose debug both okclient and its curl DEVOPS-3370
dcrossleyau Aug 23, 2024
d589efa
Disable verbose okclient
dcrossleyau Aug 23, 2024
1d3bbe2
CIRC-2122 Bypass pickup SP check for Delivery requests (#1488)
Maksat-Galymzhan Aug 23, 2024
086c70a
update kubectl action
funkymalc Aug 28, 2024
20b18fa
Merge branch 'deployment' of ssh://github.com/indexdata/mod-circulati…
funkymalc Aug 28, 2024
bf8f964
CIRC-2136 Add support for floating collections
nielserik Aug 28, 2024
fe25a60
Merge pull request #1 from indexdata/CIRC-2136-floating-collections
nielserik Aug 28, 2024
e70f55b
CIRC-2141 Allow specifying item location when creating title-level re…
JanisSaldabols Sep 6, 2024
cbf3abd
CIRC-2141 Add new field to request schema
JanisSaldabols Sep 11, 2024
3436b21
Merge pull request #2 from indexdata/CIRC-2141
JanisSaldabols Sep 17, 2024
7b49c91
Circ 2144 Extending the loan representation with additional fields re…
SreejaMangarapu Sep 20, 2024
261420d
CIRC-2136 fix for npe in check for floating
nielserik Sep 23, 2024
728ddea
Merge branch 'master' into CIRC-2136-floating-collections
nielserik Sep 23, 2024
0f90cd9
Merge pull request #3 from indexdata/CIRC-2136-floating-collections
nielserik Sep 23, 2024
396acd0
CIRC-2136 fix query limit, locations-by-service-point look-up
nielserik Oct 16, 2024
4b1964b
Merge remote-tracking branch 'origin/CIRC-2136-floating-collections' …
nielserik Oct 16, 2024
f155f2c
Merge pull request #4 from indexdata/CIRC-2136-floating-collections
nielserik Oct 16, 2024
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
27 changes: 27 additions & 0 deletions .github/workflows/k8s-deploy-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Very simple workflow to deploy the *latest* published container image with the 'latest' tag.
# This does not post updated module descriptors to okapi, update permissions or enable
# new versions of a module with the tenant. If that is needed, it should be done manually
# via the Okapi API.

name: k8s-deploy-latest

env:
K8S_NAMESPACE: 'snapshot-dev'
K8S_DEPLOYMENT: 'mod-circulation-dev'

on:
workflow_dispatch

jobs:
k8s-deploy-latest:

runs-on: ubuntu-latest
steps:
- name: Deploy latest to K8s
uses: actions-hub/[email protected]
env:
KUBE_CONFIG: ${{ secrets.SNAPSHOT_DEV_SA_KUBECONFIG }}
with:
args:
-n ${{ env.K8S_NAMESPACE }} rollout restart deployment ${{ env.K8S_DEPLOYMENT }}

132 changes: 132 additions & 0 deletions .github/workflows/mvn-dev-build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: mvn-dev-build-deploy

on:
push:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

env:
PUBLISH_BRANCH: 'deployment'
OKAPI_URL: 'https://snapshot-dev-okapi.folio-dev.indexdata.com'
OKAPI_SECRET_USER: "${{ secrets.SNAPSHOT_DEV_OKAPI_USER }}"
OKAPI_SECRET_PASSWORD: "${{ secrets.SNAPSHOT_DEV_OKAPI_PASSWORD }}"
OK_SESSION: 'session1'

jobs:
mvn-dev-build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: recursive

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin' # Alternative distribution options are available.

- name: Prepare okclient
run: git clone https://github.com/indexdata/okclient

- name: Ensure OK and FOLIO login
# So do not proceed with other workflow steps if not available.
run: |
source okclient/ok.sh
OK -S ${{ env.OK_SESSION }} \
-h ${{ env.OKAPI_URL }} \
-t "supertenant" \
-u ${{ env.OKAPI_SECRET_USER }} \
-p ${{ env.OKAPI_SECRET_PASSWORD }}
OK -S ${{ env.OK_SESSION }} -x
- name: Gather some variables
run: |
echo "MODULE_NAME=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> $GITHUB_ENV
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Set module version
run: |
echo "MODULE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-${SHA_SHORT}" >> $GITHUB_ENV
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Maven build
run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report

- name: SQ analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=indexdata -Dsonar.projectKey=indexdata_${{ github.event.repository.name }}

- name: Update ModuleDescriptor Id
run: |
if test -f "$MOD_DESCRIPTOR"; then
echo "Found $MOD_DESCRIPTOR"
cat <<< $(jq '.id = "${{ env.MODULE_NAME}}-${{ env.MODULE_VERSION }}"' $MOD_DESCRIPTOR) > $MOD_DESCRIPTOR
echo "MODULE_DESCRIPTOR=$MOD_DESCRIPTOR" >> $GITHUB_ENV
else
echo "Could not find $MOD_DESCRIPTOR"
exit 1
fi
env:
MOD_DESCRIPTOR: './target/ModuleDescriptor.json'

- name: Read ModuleDescriptor
id: moduleDescriptor
uses: juliangruber/read-file-action@v1
with:
path: ${{ env.MODULE_DESCRIPTOR }}

- name: Login to Index Data Docker Hub account
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and publish Docker image
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: indexdata/${{ env.MODULE_NAME }}:${{ env.MODULE_VERSION }},indexdata/${{ env.MODULE_NAME }}:latest

- name: Publish ModuleDescriptor to Okapi
if: ${{ env.CURRENT_BRANCH == env.PUBLISH_BRANCH }}
run: |
source okclient/ok.sh
echo "Do login ..."
OK -S ${{ env.OK_SESSION }} \
-h ${{ env.OKAPI_URL }} \
-t "supertenant" \
-u ${{ env.OKAPI_SECRET_USER }} \
-p ${{ env.OKAPI_SECRET_PASSWORD }}
echo "Post the MD and report the response status ..."
OK -S ${{ env.OK_SESSION }} _/proxy/modules \
-X post -f ${{ env.MODULE_DESCRIPTOR }}
declare -n NAMEREF_STATUS=${{ env.OK_SESSION }}_HTTPStatus
echo "Response status: $NAMEREF_STATUS"
echo "Do logout ..."
OK -S ${{ env.OK_SESSION }} -x
- name: Print module version to job summary
run: |
echo "#### Module Version: ${{ env.MODULE_VERSION }}" >> $GITHUB_STEP_SUMMARY
7 changes: 5 additions & 2 deletions ramls/examples/loan.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
{
"name": "Steve Jones"
}
]
],
"primaryContributor" : "Steve Jones"
},
"loanPolicyId" : "e9af4ba4-6801-4722-be45-d7a49d13564d",
"loanPolicy": {
Expand All @@ -37,7 +38,9 @@
"firstName" : "FirstName",
"lastName" : "LastName",
"middleName" : "MiddleName",
"barcode" : "102322966933815"
"barcode" : "102322966933815",
"preferredFirstName" : "preferredFirstName",
"patronGroup" : "3684a786-6671-4268-8ed0-9db82ebca60b"
},
"loanDate": "2017-03-01T23:11:00.000Z",
"dueDate": "2017-04-01T23:11:00.000Z",
Expand Down
15 changes: 15 additions & 0 deletions ramls/loan.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
"description": "barcode used to identify the borrower (read only, defined by the server)",
"type": "string",
"readonly": true
},
"preferredFirstName": {
"description": "preferred first name of the borrower (read only, defined by the server)",
"type": "string",
"readonly": true
},
"patronGroup": {
"description": "current patron group of the borrower (read only, defined by the server)",
"type": "string",
"readonly": true
}
},
"additionalProperties": false
Expand Down Expand Up @@ -158,6 +168,11 @@
"additionalProperties": false
}
},
"primaryContributor": {
"description": "primary contributor of the item",
"type": "string",
"readonly": true
},
"holdingsRecordId": {
"description": "The ID of the holdings for the item",
"type": "string",
Expand Down
4 changes: 4 additions & 0 deletions ramls/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@
"description": "Request fields used for search",
"type": "object",
"$ref": "request-search-index.json"
},
"itemLocationCode": {
"description": "Allow specifying item location when creating title-level requests",
"type": "string"
}
},
"additionalProperties": false,
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/folio/circulation/domain/Campus.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public static Campus unknown() {
}

public static Campus unknown(String id) {
return new Campus(id, null);
return new Campus(id, null, null);
}

String id;
String name;
String code;
}
3 changes: 2 additions & 1 deletion src/main/java/org/folio/circulation/domain/Institution.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public static Institution unknown() {
}

public static Institution unknown(String id) {
return new Institution(id, null);
return new Institution(id, null, null);
}

String id;
String name;
String code;
}
49 changes: 40 additions & 9 deletions src/main/java/org/folio/circulation/domain/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public class Item {
@Getter
private final String shelvingOrder;
@NonNull private final Location permanentLocation;

@Getter
private final Location floatDestinationLocation;
private final ServicePoint inTransitDestinationServicePoint;

private boolean changed;
Expand All @@ -57,7 +60,7 @@ public static Item from(JsonObject representation) {
}
public Item(String id, JsonObject itemRepresentation, Location effectiveLocation,
LastCheckIn lastCheckIn, CallNumberComponents callNumberComponents,
String shelvingOrder, Location permanentLocation,
String shelvingOrder, Location permanentLocation, Location floatDestinationLocation,
ServicePoint inTransitDestinationServicePoint, boolean changed,
Holdings holdings, Instance instance, MaterialType materialType,
LoanType loanType, ItemDescription description) {
Expand All @@ -69,6 +72,7 @@ public Item(String id, JsonObject itemRepresentation, Location effectiveLocation
this.callNumberComponents = callNumberComponents;
this.shelvingOrder = shelvingOrder;
this.permanentLocation = permanentLocation;
this.floatDestinationLocation = floatDestinationLocation;
this.inTransitDestinationServicePoint = inTransitDestinationServicePoint;
this.changed = changed;
this.holdings = holdings;
Expand Down Expand Up @@ -348,59 +352,86 @@ public String getPermanentLocationId() {
return firstNonBlank(permanentLocation.getId(), holdings.getPermanentLocationId());
}

public String getFloatDestinationLocationId() {
return floatDestinationLocation != null ? floatDestinationLocation.getId() : null;
}

public boolean canFloatThroughCheckInServicePoint() {
return getLocation() != null
&& getLocation().isFloatingCollection()
&& getFloatDestinationLocation() != null
&& getFloatDestinationLocation().getId() != null;
}

public Item withLocation(Location newLocation) {
return new Item(this.id, this.itemRepresentation, newLocation,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, description);
}

public Item withMaterialType(@NonNull MaterialType materialType) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, materialType, this.loanType, this.description);
}

public Item withHoldings(@NonNull Holdings holdings) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withInstance(@NonNull Instance instance) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, instance, this.materialType, this.loanType, this.description);
}

public Item withLoanType(@NonNull LoanType loanType) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, loanType, this.description);
}

public Item withLastCheckIn(@NonNull LastCheckIn lastCheckIn) {
return new Item(this.id, this.itemRepresentation, this.location,
lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, this.inTransitDestinationServicePoint, this.changed,
this.permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withPermanentLocation(Location permanentLocation) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
permanentLocation, this.inTransitDestinationServicePoint, this.changed,
permanentLocation, this.floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withFloatDestinationLocation(Location floatDestinationLocation) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, floatDestinationLocation,
this.inTransitDestinationServicePoint, this.changed,
this.holdings, this.instance, this.materialType, this.loanType, this.description);
}

public Item withInTransitDestinationServicePoint(ServicePoint servicePoint) {
return new Item(this.id, this.itemRepresentation, this.location,
this.lastCheckIn, this.callNumberComponents, this.shelvingOrder,
this.permanentLocation, servicePoint, this.changed, this.holdings,
this.permanentLocation, this.floatDestinationLocation,
servicePoint, this.changed, this.holdings,
this.instance, this.materialType, this.loanType, this.description);
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/folio/circulation/domain/Library.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ public static Library unknown() {
}

public static Library unknown(String id) {
return new Library(id, null);
return new Library(id, null, null);
}

String id;
String name;
String code;
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ private void additionalBorrowerProperties(JsonObject loanRepresentation, User bo
borrowerSummary.put("lastName", borrower.getLastName());
borrowerSummary.put("middleName", borrower.getMiddleName());
borrowerSummary.put("barcode", borrower.getBarcode());

borrowerSummary.put("preferredFirstName",borrower.getPreferredFirstName());
borrowerSummary.put("patronGroup",borrower.getPatronGroupId());
loanRepresentation.put(BORROWER, borrowerSummary);

additionalPatronGroupProperties(loanRepresentation, borrower.getPatronGroup());
}

Expand Down
Loading