Added Validation to poLine and Titles APIs

Description

Overview

As a follow-on to MODORDERS-374, we need to add some validation/error responses for edge cases related to title creation:

PoLIne

  • isPackage should be protected so that it can't be changed on an open order. This means we wouldn't be able to get into this situation (at least from the UI).

Titles

  • In POST /orders/titles only allow titles to be created for orders in OPEN status and the associated POL's isPackage = true. Return an appropriate error message/code otherwise.

  • In POST /orders/titles only allow a single title for a given POL if isPackage = false. Return an appropriate error message/code otherwise.

NOTE: Determining this criteria can be accomplished with a single API call to the storage API that uses a view to combine PO/POL. FYI: The query used would likely change when we move to cross-table subqueries.

Take into account that titles are also creating/updating transactionally with associated polines on storage level. https://folio-org.atlassian.net/browse/MODORDSTOR-127

Acceptance Criteria

  • Title and PoLine APIs contain the extra validation/error responses described above

  • API tests are updated

  • Unit tests are updated

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Attachments

2

Checklist

hide

TestRail: Results

Activity

Show:

Details

Assignee

Reporter

Priority

Story Points

Development Team

Thunderjet

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created March 31, 2020 at 3:16 PM
Updated December 9, 2021 at 8:57 PM
Loading...