Skip to content

Additional approval of requests

Requesting material now requires validation only by the requestor. A link is sent to the request.email and once clicked, the request is VALIDATED and relayed to the genebanks (and the request status becomes DISPATCHED).

In this ticket we are introducing an additional (but optional) approval by a second user. This approval only executes when request.approver != null.

  • The requestor validates the request
  • Service executes validateClientRequest and validateRequest and the request becomes VALIDATED
    • If request.approver != null:
      • generate a new token of type approve-request
      • populate email template smtp-material-approve with request data (same as the current validation email)
      • sends it to request.approver
      • sets request.state = NOTAPPROVED
    • If request.approver == null it proceeds with breakup and relayRequests -- the current flow.

The approver receives the email with a link to approve/reject the request. The link leads to Genesys UI where the approver can click "Approve" and "Reject" buttons:

  • Service executes approveClientRequest(String tokenUuid, String key, boolean approve)
    • It consumes the key, finds the request and ensures that request.state == NOTAPPROVED
    • if approve == true set request.state == APPROVED and call breakup and relayRequests
    • if approve == false set request.state == REJECTED and send an email (template smtp-material-rejected) to requestor and approver that the request has been rejected

Model changes

In MaterialRequest:

  • Add @ValidEmail String approver
  • Add states: NOTAPPROVED(10), APPROVED(11), REJECTED(12)

Service changes

Implement logic as described above.

API changes

  • Add endpoint that returns request data for tokenUuid + key without consuming the token: we will use this endpoint to display request information to the approver and help them make the approval decision before calling approveClientRequest
  • Add endpoint interfacing with approveClientRequest for approval/reject operation