In order to facilitate efficient and timely data migration functionality, the Invoice Storage module needs the ability to Create and Update invoices in bulk, rather than processing records individually.
For adding and updating a list of records RMB already provides the PgUtil.postSync method that all modules can use: https://github.com/folio-org/raml-module-builder/blob/v31.1.0/domain-models-runtime/src/main/java/org/folio/rest/persist/PgUtil.java
- Users shall be able to POST a JSON object with an array of multiple invoice records to a single endpoint.
- Individual records shall be assumed to be valid, and shall not be subject to individual record business logic
- Records shall be committed to the database in a single transaction
- Should the operation fail due to an error in an individual record, an error message shall be returned that alerts the user where to look in the record set to find the problem.
- On success, the endpoint shall return a JSON object with the counts for number of records created and number of records updated.
- User provided metadata and id values shall be preferred; if absent, then system-provided values may be calculated. This is current blocked for metadata values, which always overwrite user-provided data.