Skip to main content

Edit delivery

PUT 

/company/delivery/:service_code

Update the details of an existing shipment. Editable fields depend on the shipment's current status.

Objective

Allow companies to modify certain aspects of their shipments based on their current status, maintaining change control via replannedBy.

Use Cases

  • Modify load/unload dates for planned or accepted shipments
  • Update cargo details (weight, height, pallets, temperature)
  • Correct cargo linear meters
  • Initiate a re-planning process requiring approval

Editable Fields by Status

Status 'planned' or 'replanned': Editable: etl_date, etd_date, pallets_num, fresh_cargo_temp, cargo_weight, cargo_height, linear_meters

Status 'accepted': Editable: etl_date, etd_date

Any other edit:

  • Changes status to 'replanned'
  • Sets replannedBy to 'cia' (company)

Validation Flow

flowchart TD
A[Receive Edit Request] --> B{Delivery Exists?}
B -->|No| C[404 NOT_FOUND]
B -->|Yes| D{Company Owns Delivery?}
D -->|No| E[404 NOT_ALLOWED]
D -->|Yes| F{Is Final Status?}
F -->|Yes| G[401 NOT_ALLOWED]
F -->|No| H[Get Editable Keys]
H --> I{Any Valid Keys?}
I -->|No| J[401 NOT_ALLOWED]
I -->|Yes| K[Update Fields]
K --> L[Set status=replanned]
L --> M[Set replannedBy=cia]
M --> N[Save Changes - 200]

Notes

  • Shipments in final status (delivered, claimed, canceled) cannot be edited
  • Any edit automatically changes the status to 'replanned'
  • If the trucker must approve the changes, replannedBy='trucker'
  • The company approves the trucker's changes with PUT /aprove/{service_code}

Request

Responses

Successfully updated shipping