- Add `external_number NVARCHAR(100)` column to the `manifest` table. - Thread `externalNumber` through manifestDoc and delivery SQL (list, header, create, update). - Include `externalNumber` in shapeSummary and quote/order/delivery create/update/list/getById handlers (optional, clearable on update). - Update README type definitions and regenerate API/schema docs.
3.8 KiB
delivery
This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.
delivery.create
Source: src/store/delivery/create.js
Creates a new delivery for the user's selected company with its lines.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
body |
object |
The delivery input. |
body.number |
string |
The delivery number. |
body.date |
string |
The delivery date. |
body.supplierId |
number |
The id of the supplier. |
[body.externalNumber] |
string |
An external (supplier) reference number. |
[body.lines] |
Array<object> |
The delivery lines. |
Returns
Promise<{id: number, number: string, type: string, entityId: number, externalNumber: string|null, date: string, lines: Array<object>}> — The created delivery.
Throws
Error — If the delivery is invalid.
Example
const delivery = await store.delivery.create(42, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
// => { id, number, type, entityId, externalNumber, date, lines: [...] }
delivery.delete
Source: src/store/delivery/delete.js
Deletes a delivery by its id within the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The id of the delivery to delete. |
Returns
Promise<void>
Throws
Error — If the delivery is not found.
Example
await store.delivery.delete(42, 5);
delivery.getById
Source: src/store/delivery/getById.js
Returns a single delivery by its id within the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The id of the delivery. |
Returns
Promise<{id: number, number: string, type: string, entityId: number, externalNumber: string|null, date: string, lines: Array<object>}> — The delivery.
Throws
Error — If the delivery is not found.
Example
const delivery = await store.delivery.getById(42, 5);
// => { id, number, type, entityId, externalNumber, date, lines: [...] }
delivery.list
Source: src/store/delivery/list.js
Lists the deliveries of the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
Returns
Promise<Array<{id: number, number: string, type: string, entityId: number, externalNumber: string|null, date: string}>> — The deliveries.
Example
const deliveries = await store.delivery.list(42);
// => [{ id, number, type, entityId, externalNumber, date }]
delivery.update
Source: src/store/delivery/update.js
Updates a delivery's header and/or lines.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The id of the delivery to update. |
patch |
object |
The update patch. |
[patch.number] |
string |
The new delivery number. |
[patch.date] |
string |
The new delivery date. |
[patch.supplierId] |
number |
The new supplier id. |
[patch.externalNumber] |
string |
The new external (supplier) reference number. |
[patch.lines] |
Array<object> |
The new delivery lines. |
Returns
Promise<{id: number, number: string, type: string, entityId: number, externalNumber: string|null, date: string, lines: Array<object>}> — The updated delivery.
Throws
Error — If the delivery is not found.
Example
const delivery = await store.delivery.update(42, 5, { number: 'D-2', lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }