Filter requests by item effective location (UXPROD-2285)

Purpose

Users need to be able to filter requests (Requests app) by Item effective location. A filter accordion needs to be added to "Search & filter" pane on the Requests page. It should enable a user to select one or more locations and filter requests on Item effective locations.

Approach

BE: add itemEffectiveLocationId field

In order to keep the existing performance level of the request search, a new UUID field has to be added to the request-search-index.json schema - itemEffectiveLocationId. An index should be created for this field in schema.json.

Proposed stories:

BE: populate itemEffectiveLocationId field in new requests

mod-circulation creates requests and saves them in the mod-circulation-storage's database, which means that mod-circulation also needs to be aware of the new field.

Proposed stories:

  • CIRC-1959 - Getting issue details... STATUS

    Use this PR as a reference: https://github.com/folio-org/mod-circulation/pull/1261
    Note: searchIndex field is being removed from the request object by mod-circulation before it returns a request to the client, we should keep this behavior. UI doesn't need to see the searchIndex field, we only need it for filtering purposes. In order to see this field's value, one needs to call mod-circulation-storage directly.

BE: populate itemEffectiveLocationId in existing requests (data migration)

After we add itemEffectiveLocationId filed to the request schema, its value will be missing from the requests already existing in the DB. Unfortunately, items are stored in the different module's schema (mod-inventory-storage) and it is impossible to implement such data migration with a simple SQL script. Instead, a migration service similar to RequestSearchFieldsMigrationService needs to be created.

Proposed stories:

  • CIRCSTORE-467 - Getting issue details... STATUS
    Create a service with dummy methods, add constants for migration module versions, endpoints required for the migration etc. and call the new service from Tenant API. Use RequestSearchFieldsMigrationService class as a reference.
  • CIRCSTORE-468 - Getting issue details... STATUS
    Implement dummy methods, create tests. Use RequestSearchFieldsMigrationService class as a reference.

BE: keep request.itemEffectiveLocationId in-sync with mod-inventory-storage

Item can be updated by a user in the inventory app and we need to keep mod-circulation-storage data in-sync with the help of the domain event pattern. mod-circulation-storage already consumes item update events and updates requests based on these updates, ItemUpdateProcessorForRequest class serves this purpose and it needs to be extended to also update itemEffectiveLocationId field.

Proposed stories:

FE: query structure

On the FE side, the same approach will be used as for all other filters. When filtering by effective location is enabled, the CQL query will look like this: query=(... and itemEffectiveLocationId==("..." OR "...")) sortby ...