Skip to end of banner
Go to start of banner

Automated Patron Blocks feature design

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Purpose of this document

It needs to be decided which module "automated patron blocks" functionality has to be implemented in. There are few options:

  • mod-circulation (Approach 1)
  • new "automated blocks" module (mod-automated-blocks)

    • fetching data from mod-circulation (circular dependency)

    • fetching data from mod-circulation-storage

    • consuming events published by mod-circulation

      • mod-circulation requests block from mod-automated-blocks
      • mod-automated-blocks publishes block events

Overview

It is required for a number of modules (both BE and FE) to be able to check if a patron should be blocked from borrowing, renewing and/or requesting items and why. mod-circulation should check for these blocks every time one of these actions is performed. Also, we need to provide an endpoint (at least for UI modules, see UIU-1273) for checking patron block conditions. Each of these condition checks has a dependency on functionality implemented in various modules:

ConditionModulePurpose

Maximum outstanding fee/fine balance

mod-feesfines

Calculate fee/fine balance

Maximum number of items charged out

mod-circulation

Get the number of open loans

Maximum number of lost items

mod-feesfines

Get a number of open fees/fines with item status "Aged to lost" or "Declared lost"

Maximum number of overdue item

mod-circulation

Get overdue period (CIRC-548)

Maximum number of overdue recalled items

mod-circulation

Get overdue period (CIRC-548)

Maximum number of overdue days for recalled item

mod-circulation

Get overdue period (CIRC-548)

Approach 1 (mod-circulation)

API

Even though most of the checks will be happening internally in mod-circulation, other modules (UIU-1273) will need to use this functionality to display existing patron blocks to the user, so it is proposed to add a new endpoint:

GET /automated-patron-blocks/{patronId}

Response example:

{
  "automatedPatronBlocks": [
    {
      "blockBorrowing": true,
      "blockRenewal": false,
      "blockRequest": false,
      "message": "Patron has reached maximum allowed number of items charged out"
    },
    {
      "blockBorrowing": false,
      "blockRenewal": false,
      "blockRequest": true,
      "message": "Patron has reached maximum allowed outstanding fee/fine balance for his/her patron group"
    }
  ]
}

Dependencies

No new dependencies are required in mod-circulation for Approach 1.

ModuleEndpointNew module dependencyPurpose

mod-users

/patron-block-condition
/patron-block-limits?query=(patronGroupId=={patronGroupId})
No

Get conditions and limits to be checked.

mod-feesfines

/accounts?query=(userId=={patronId} AND status=="Open")
No

Check outstanding fee/fine balance and number of open fees/fines for lost items.

mod-calendar

/calendar/periods
No

Calculate the overdue period (already implemented in CIRC-548).

Approach 2 (new module; pub-sub)

Publishing/subscriptions configuration

Module

Publish/subscribe

Event type

Payload

mod-feesfines

publish

PATRON_FEE_FINE_BALANCE_CHANGE_EVENT

{
  "patronId": string,
  "balance": numeric
}

Example:

{
  "patronId": "1785d668-831e-11ea-bc55-0242ac130003",
  "balance": -15
}
mod-circulationpublish

ITEM_CHECK_OUT_EVENT

{
  "patronId": string,
  "loanId": string,
  "dueDate": string
}
mod-circulationpublishITEM_CHECK_IN_EVENT
{
  "patronId": string,
"loanId": string
}
mod-circulationpublishITEM_DECLARED_LOST_EVENT
{
  "patronId": string,
"loanId": string
}
mod-circulationpublishLOAN_DUE_DATE_UPDATE_EVENT
{
  "patronId": string,
  "loanId": string,
  "dueDate": string,
"recall": boolean
}



  • No labels