Add acquisitions-unit-assignments.recordId to receiving-history view
Description
Environment
None
Potential Workaround
None
clones
has to be done before
Checklist
hideTestRail: Results
Activity
Show:
Craig McNallyJuly 11, 2019 at 4:58 PM
Verified as part of https://folio-org.atlassian.net/browse/MODORDSTOR-95#icft=MODORDSTOR-95
Raman AsadchyJuly 10, 2019 at 7:02 PM
Verified on folio-testing :
1) Set up environment variables
export OKAPITOKEN=...
export OKAPI=https://folio-testing-okapi.aws.indexdata.com
2) Create two acq-units :
Request 1
curl -X POST $OKAPI/acquisitions-units-storage/units \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"name": "Test unit 1"
}' -w '\n'
Response :
{
"id": "c4024594-bf01-425a-9f70-2f152170e060",
"name": "Test unit 1",
"protectCreate": true,
"protectRead": false,
"protectUpdate": true,
"protectDelete": true,
"metadata": {
"createdDate": "2019-07-10T17:41:53.136+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T17:41:53.136+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
Request 2
curl -X POST $OKAPI/acquisitions-units-storage/units \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"name": "Test unit 2"
}' -w '\n'
Response :
{
"id": "92124a35-237b-42a1-880d-cf48838a364a",
"name": "Test unit 2",
"protectCreate": true,
"protectRead": false,
"protectUpdate": true,
"protectDelete": true,
"metadata": {
"createdDate": "2019-07-10T17:43:37.522+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T17:43:37.522+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
3) Create two orders:
Request 1
curl -X POST $OKAPI/orders-storage/purchase-orders \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"orderType": "One-Time",
"notes": [
"MODORDSTOR-96"
],
"poNumber": "TESTVIEWS1",
"vendor": "50fb6ae0-cdf1-11e8-a8d5-f2801f1b9fd1"
}' -w '\n'
Response:
{
"id": "579c516c-c62e-4bcf-b271-6d0085141283",
"approved": false,
"notes": [
"MODORDSTOR-96"
],
"poNumber": "TESTVIEWS1",
"orderType": "One-Time",
"reEncumber": false,
"vendor": "50fb6ae0-cdf1-11e8-a8d5-f2801f1b9fd1",
"workflowStatus": "Pending",
"metadata": {
"createdDate": "2019-07-10T17:47:20.287+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T17:47:20.287+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
Request 2
curl -X POST $OKAPI/orders-storage/purchase-orders \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"orderType": "One-Time",
"notes": [
"MODORDSTOR-96"
],
"poNumber": "TESTVIEWS2",
"vendor": "50fb6ae0-cdf1-11e8-a8d5-f2801f1b9fd1"
}' -w '\n'
Response:
{
"id": "ebff9ecf-5cd3-4c00-a014-2c21339d8c8b",
"approved": false,
"notes": [
"MODORDSTOR-96"
],
"poNumber": "TESTVIEWS2",
"orderType": "One-Time",
"reEncumber": false,
"vendor": "50fb6ae0-cdf1-11e8-a8d5-f2801f1b9fd1",
"workflowStatus": "Pending",
"metadata": {
"createdDate": "2019-07-10T17:50:14.409+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T17:50:14.409+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
4)Create one line for each order:
Request 1
curl -X POST $OKAPI/orders-storage/po-lines \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"acquisitionMethod": "Purchase",
"purchaseOrderId": "f660e48d-42fa-44d9-b17b-59c3b4bffca0",
"source": {
"code": "FOLIO"
},
"orderFormat": "Physical Resource",
"physical":{
"createInventory": "None"
},
"cost":{
"currency":"USD",
"listUnitPrice": 1,
"quantityPhysical":1
},
"title": "Line for the first order"
}' -w '\n'
Response :
{
"id": "f0726342-55ce-4bcd-ad97-064182068820",
"checkinItems": false,
"acquisitionMethod": "Purchase",
"alerts": [],
"claims": [],
"collection": false,
"contributors": [],
"cost": {
"listUnitPrice": 1.0,
"currency": "USD",
"discountType": "percentage",
"quantityPhysical": 1
},
"fundDistribution": [],
"locations": [],
"orderFormat": "Physical Resource",
"paymentStatus": "Pending",
"physical": {
"createInventory": "None",
"volumes": []
},
"purchaseOrderId": "579c516c-c62e-4bcf-b271-6d0085141283",
"receiptStatus": "Pending",
"reportingCodes": [],
"rush": false,
"source": {
"code": "FOLIO"
},
"tags": [],
"title": "Line for the first order",
"metadata": {
"createdDate": "2019-07-10T18:02:00.683+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T18:02:00.683+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
Request 2:
curl -X POST $OKAPI/orders-storage/po-lines \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"acquisitionMethod": "Purchase",
"purchaseOrderId": "f660e48d-42fa-44d9-b17b-59c3b4bffca0",
"source": {
"code": "FOLIO"
},
"orderFormat": "Physical Resource",
"physical":{
"createInventory": "None"
},
"cost":{
"currency":"USD",
"listUnitPrice": 1,
"quantityPhysical":1
},
"title": "Line for the second order"
}' -w '\n'
Response :
{
"id": "6d3e79b6-d4bf-4d2e-a5b4-63ab7183dc36",
"checkinItems": false,
"acquisitionMethod": "Purchase",
"alerts": [],
"claims": [],
"collection": false,
"contributors": [],
"cost": {
"listUnitPrice": 1.0,
"currency": "USD",
"discountType": "percentage",
"quantityPhysical": 1
},
"fundDistribution": [],
"locations": [],
"orderFormat": "Physical Resource",
"paymentStatus": "Pending",
"physical": {
"createInventory": "None",
"volumes": []
},
"purchaseOrderId": "ebff9ecf-5cd3-4c00-a014-2c21339d8c8b",
"receiptStatus": "Pending",
"reportingCodes": [],
"rush": false,
"source": {
"code": "FOLIO"
},
"tags": [],
"title": "Line for the second order",
"metadata": {
"createdDate": "2019-07-10T18:05:34.081+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T18:05:34.081+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
5) Create piece for each line
Request 1
curl -X POST $OKAPI/orders-storage/pieces \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"caption": "Tutorial Volume 5",
"comment": "Piece for the first line",
"format": "Electronic",
"poLineId": "f0726342-55ce-4bcd-ad97-064182068820",
"receivingStatus": "Expected"
}' -w '\n'
Response :
{
"id": "ed835f7c-395a-4cc3-b6f1-bc9edad2bf37",
"caption": "Tutorial Volume 5",
"comment": "Piece for the first line",
"format": "Electronic",
"poLineId": "f0726342-55ce-4bcd-ad97-064182068820",
"receivingStatus": "Expected"
}
Request 2
curl -X POST $OKAPI/orders-storage/pieces \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"caption": "Tutorial Volume 5",
"comment": "Piece for the second line",
"format": "Electronic",
"poLineId": "6d3e79b6-d4bf-4d2e-a5b4-63ab7183dc36",
"receivingStatus": "Expected"
}' -w '\n'
Response :
{
"caption": "Tutorial Volume 5",
"comment": "Piece for the second line",
"format": "Electronic",
"poLineId": "6d3e79b6-d4bf-4d2e-a5b4-63ab7183dc36",
"receivingStatus": "Expected"
}
6)Assign one units to the first order
Request 1 :
curl -X POST $OKAPI/orders-storage/acquisitions-unit-assignments \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"recordId": "579c516c-c62e-4bcf-b271-6d0085141283",
"acquisitionsUnitId": "c4024594-bf01-425a-9f70-2f152170e060"
}' -w '\n'
Response :
{
"id": "8807e32d-98d3-441d-8d4f-8954d536dc73",
"recordId": "579c516c-c62e-4bcf-b271-6d0085141283",
"acquisitionsUnitId": "c4024594-bf01-425a-9f70-2f152170e060",
"metadata": {
"createdDate": "2019-07-10T18:26:24.095+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T18:26:24.095+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
7) Assign both users to the second order
Request :
curl -X POST $OKAPI/orders-storage/acquisitions-unit-assignments \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"recordId": "ebff9ecf-5cd3-4c00-a014-2c21339d8c8b",
"acquisitionsUnitId": "92124a35-237b-42a1-880d-cf48838a364a"
}' -w '\n'
Response :
{
"id": "eec195c7-6e21-4be0-8c39-94c75cb57889",
"recordId": "ebff9ecf-5cd3-4c00-a014-2c21339d8c8b",
"acquisitionsUnitId": "92124a35-237b-42a1-880d-cf48838a364a",
"metadata": {
"createdDate": "2019-07-10T18:32:34.772+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T18:32:34.772+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
Request 2:
curl -X POST $OKAPI/orders-storage/acquisitions-unit-assignments \
-H 'Content-Type: application/json' \
-H "x-okapi-token: $OKAPITOKEN" \
-d '{
"recordId": "579c516c-c62e-4bcf-b271-6d0085141283",
"acquisitionsUnitId": "92124a35-237b-42a1-880d-cf48838a364a"
}' -w '\n'
Response:
{
"id": "bafcdb20-52a3-4da4-8185-ccf9f67220b3",
"recordId": "579c516c-c62e-4bcf-b271-6d0085141283",
"acquisitionsUnitId": "92124a35-237b-42a1-880d-cf48838a364a",
"metadata": {
"createdDate": "2019-07-10T18:29:25.953+0000",
"createdByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d",
"updatedDate": "2019-07-10T18:29:25.953+0000",
"updatedByUserId": "5e04cb46-21d3-5dad-b836-f54fa43d301d"
}
}
8) Search for orders using /orders-storage/receiving-history endpoint
Get history for the first user :
Requset
curl $OKAPI/orders-storage/receiving-history --data-urlencode 'query=acquisitionsUnitId==c4024594-bf01-425a-9f70-2f152170e060' -H "X-Okapi-Token: $OKAPITOKEN" -w '\n' -G -s
Response
{
"receivingHistory": [
{
"id": "ed835f7c-395a-4cc3-b6f1-bc9edad2bf37",
"caption": "Tutorial Volume 5",
"comment": "Piece for the first line",
"checkin": false,
"poLineId": "f0726342-55ce-4bcd-ad97-064182068820",
"poLineReceiptStatus": "Pending",
"pieceFormat": "Electronic",
"purchaseOrderId": "579c516c-c62e-4bcf-b271-6d0085141283",
"receivingStatus": "Expected",
"title": "Line for the first order"
}
],
"totalRecords": 1
}
Get history for the second user :
Request
curl $OKAPI/orders-storage/receiving-history --data-urlencode 'query=acquisitionsUnitId==92124a35-237b-42a1-880d-cf48838a364a' -H "X-Okapi-Token: $OKAPITOKEN" -w '\n' -G -s
Response:
{
"receivingHistory": [
{
"id": "64cecdfa-e310-4895-893b-2423f7b83bfc",
"caption": "Tutorial Volume 5",
"comment": "Piece for the second line",
"checkin": false,
"poLineId": "6d3e79b6-d4bf-4d2e-a5b4-63ab7183dc36",
"poLineReceiptStatus": "Pending",
"pieceFormat": "Electronic",
"purchaseOrderId": "ebff9ecf-5cd3-4c00-a014-2c21339d8c8b",
"receivingStatus": "Expected",
"title": "Line for the second order"
},
{
"id": "ed835f7c-395a-4cc3-b6f1-bc9edad2bf37",
"caption": "Tutorial Volume 5",
"comment": "Piece for the first line",
"checkin": false,
"poLineId": "f0726342-55ce-4bcd-ad97-064182068820",
"poLineReceiptStatus": "Pending",
"pieceFormat": "Electronic",
"purchaseOrderId": "579c516c-c62e-4bcf-b271-6d0085141283",
"receivingStatus": "Expected",
"title": "Line for the first order"
}
],
"totalRecords": 2
}
10) Delete created request
curl -i -XDELETE $OKAPI/orders-storage/pieces/ed835f7c-395a-4cc3-b6f1-bc9edad2bf37 -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/orders-storage/pieces/64cecdfa-e310-4895-893b-2423f7b83bfc -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/orders-storage/po-lines/f0726342-55ce-4bcd-ad97-064182068820 -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/orders-storage/po-lines/6d3e79b6-d4bf-4d2e-a5b4-63ab7183dc36 -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/orders-storage/purchase-orders/579c516c-c62e-4bcf-b271-6d0085141283 -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/orders-storage/purchase-orders/ebff9ecf-5cd3-4c00-a014-2c21339d8c8b -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/acquisitions-units-storage/units/c4024594-bf01-425a-9f70-2f152170e060 -H "x-okapi-token: $OKAPITOKEN" -w '\n'
curl -i -XDELETE $OKAPI/acquisitions-units-storage/units/92124a35-237b-42a1-880d-cf48838a364a -H "x-okapi-token: $OKAPITOKEN" -w '\n'
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
HTTP/2 204
...
Done
Details
Assignee
Craig McNallyCraig McNallyReporter
Craig McNallyCraig McNallyTester Assignee
Craig McNallyCraig McNallyPriority
P3Story Points
1Sprint
NoneDevelopment Team
ThunderjetFix versions
TestRail: Cases
Open TestRail: CasesTestRail: Runs
Open TestRail: Runs
Details
Details
Assignee
Craig McNally
Craig McNallyReporter
Craig McNally
Craig McNallyTester Assignee
Craig McNally
Craig McNallyPriority
Story Points
1
Sprint
None
Development Team
Thunderjet
Fix versions
TestRail: Cases
Open TestRail: Cases
TestRail: Runs
Open TestRail: Runs
Created June 6, 2019 at 8:43 PM
Updated July 11, 2019 at 4:58 PM
Resolved July 11, 2019 at 4:58 PM
TestRail: Cases
TestRail: Runs
Overview
As part of the acquisitions unit effort, the acquisitions unit assignments table needs to be integrated into the view used for querying receiving-history.
Approach
Currently we have the ability to query a view which combines purchase-order, po-line, pieces etc. tables (
GET /orders-storage/receiving-history?query=...
). This should also be updated to include acquisitions-unit-assignments onpurchaseOrderId == acquisitions-unit-assignments.recordId
.Additional background can be found on the wiki
Acceptance Criteria
The existing "receiving-history" view is updated
Unit tests are updated