Spike: CIRC-436 - Delivery requests: support request preferences of user

CIRC-436 - Getting issue details... STATUS

The goal of the spike is to define the necessary steps to introduce Request Preferences per User in mod-circulation.

Spike results:

1. Storing request preferences in mod-circulation-storage:

We will add table user_request_preferences to mod-circulation-storage. user_request_preferences will store user preference fields in json format. 

Table definition in mod-circulation-storage:


user_request_preferences
{
  "tableName": "user_request_preferences",
  "withMetadata": true,
  "withAuditing": false,
  "uniqueIndex": [
    {
      "fieldName": "userId",
      "tOps": "ADD",
      "caseSensitive": false
    }
  ]
}

2. API for request preferences:

API endpoint will follow standard format for endpoints in folio:

1) GET /request-preference-storage/request-preference -  endpoint for searching, UI will get preferences related to user by sending request "GET /request-preference-storage/request-preference?query=userId==1e425b93-501e-44b0-a4c7-b3e66a25c42e"

2) POST /request-preference-storage/request-preference - create request preference

3) GET /request-preference-storage/request-preference/{id} - get request preference by id ("id" field is not the same as "userId")

4) DELETE /request-preference-storage/request-preference/{id} - delete request preference

5) PUT /request-preference-storage/request-preference/{id} - update request preference

3. Attributes of user request preference:

id - Unique request preference ID
userId - UUID of user associated with this request preference
holdShelf - Whether 'Hold shelf' option is available to the user.
delivery - Whether 'Delivery' option is available to the user.
defaultServicePointId - UUID of default service point for 'Hold shelf' option
defaultDeliveryAddressTypeId - UUID of user's address type
fulfillment - Preferred fulfillment type. Possible values are 'Delivery', 'Hold shelf'

Example of request preference:

Request preference
{
  "userId": "1e425b93-501e-44b0-a4c7-b3e66a25c42e",
  "holdShelf" : true,
  "delivery": true,
  "defaultServicePointId": "22beccec-8d77-4a97-906a-37cc26b070e5",
  "defaultDeliveryAddressTypeId": "27a1b086-20ac-4b1d-b6ac-3be353383f3d",
  "fulfillment": "Delivery"
}

4. POC: 

Created a draft pull request with simple implementation of request-preference-storage endpoints
https://github.com/folio-org/mod-circulation-storage/pull/200