Skip to main content

Loads

Packages consolidated onto one departure at its origin node (aggregate Load).

📄️Introduction

REST contract of the linehaul-transportation bounded context of the retail network, derived from retail-network-docs apis/linehaul-transportation/openapi.yaml and model/model.yaml (contexts[linehaul-transportation].rest), adjusted by the Model Gap Register decisions G3, G9, G14, G15, G28 and G29 and by the cross-context decisions E3, E13, E14 and E16 (ADR 0002). The service runs the middle mile: it turns lane schedules and the declared cutoffs of vendor nodes into scheduled departures, keeps each departure's remaining capacity, builds loads of packages onto departures and reports when loads depart and arrive. The planner calls the lane-schedule routes, the departure cancellation and capacity routes; sort-centre and station operators call the load routes; any context may call the departure reads. Domain events are published on Kafka (apis/asyncapi.yaml), never over REST. No authentication, consistent with the fleet. Errors are RFC 9457 problem details; the shared problem types are not-found (404), illegal-transition (409), concurrent-update (409) and validation-failed (422), plus one type per model Err name. Every POST takes a required Idempotency-Key; PUT is idempotent by method.

📄️Add a package to an open load (AddPackage)

Refused with 409 package-already-loaded (ErrPackageAlreadyLoaded) if the tracking number is on another OPEN or CLOSED load, and with 409 load-over-capacity (ErrLoadOverCapacity) if the load would exceed its capacity snapshot. On a LINEHAUL or AIR departure the package is also booked on the departure (gap G15): 409 departure-full or departure-closed when it cannot be. On a PICKUP departure the booking was made at FulfillmentLocked and booked does not change. Adding a tracking number that is already on this load changes nothing.

📄️Define the weekly schedule of a lane (DefineLaneSchedule)

Creates the ACTIVE weekly template of one lane, or replaces the slots of an ACTIVE template (201 on creation, 200 on replacement; a redefinition takes effect from the next horizon roll, departures that were already generated stay). The lane must be known (LaneView). Slots must not overlap on the same weekday (overlapping-slots). A RETIRED schedule cannot be redefined (illegal-transition). Raises no event. Departures are generated by GenerateDepartures (policy HorizonRoll).