Move to use of batch receiving piece creation

Description

A new API is available supporting the creation of many receiving pieces via a single API call. We should migrate our current receiving piece creation (which requires an API call for each piece created) to using this new process.

There is a single parameter for item creation (as currently this is a param on the API call) but all other fields can be set per item

Documentation at https://s3.amazonaws.com/foliodocs/api/mod-orders/r/pieces-batch.html#orders_pieces_batch_post

Work on this story should include:

  • Ensuring that the batch creation works well for up to 366 pieces (the maximum we currently allow in a single predicted piece set)

  • Adding or updating any interface dependencies we declare if necessary

  • Ensuring that we are able to reliably match the receiving pieces listed in the response to our predicted pieces, so we can store the IDs as currently

Environment

None

Potential Workaround

None

CSP Approved

None

CSP Request Details

None

CSP Rejection Details

None

Checklist

hide

Activity

Show:

Jack Golding February 24, 2025 at 2:23 PM

For further context:

Within the component this is the section that will need to be refactored, instead of a Promise.all it should be a singular post request to the new order/batch-pieces endpoint, we will still need to format the receiving piece as shown there but with the addition of a generated ID field to go as well, then, using the IDs taken from the previously made post request, we will then need add them into this section of the code

Jag Goraya February 24, 2025 at 11:45 AM
Edited

Feb 24, 2025 https://www.npmjs.com/package/uuid This will allow frontend generation of UUIDs, which can be used to key on the api return

import { v4 as uuidv4 } from 'uuid'; ... const handleCreate = useCallback((data) => { if (!data?.id) { data.id = uuidv4(); } return createDirectoryEntry(data); }, []);
Done

Details

Assignee

Reporter

Priority

Sprint

Development Team

Bienenvolk

Release

Sunflower (R1 2025)

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created February 7, 2025 at 11:53 AM
Updated March 7, 2025 at 4:53 PM
Resolved March 7, 2025 at 4:53 PM
TestRail: Cases
TestRail: Runs

Flag notifications