Files
dashlibstorage/API.delivery.md
seb aefd97a171 Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- Rewrite JSDoc across all store methods to document the actual async
  methods (real params, returns, throws) instead of the internal wrappers
- Split quote/order into individual module files backed by shared
  manifestDoc helpers; remove the createStore factory and thin wrappers
- Deduplicate manifest line helpers into src/store/manifestLines.js
- Extend generate-api-doc.js to render parameter/return/throws types and
  emit per-namespace API.<module>.md files with an API.md index
- Regenerate all API docs
2026-08-07 06:23:17 +02:00

147 lines
3.5 KiB
Markdown

# 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.lines]` | `Array<object>` | The delivery lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number, date: string, lines: Array<object>}>` — The created delivery.
**Throws**
`Error` — If the delivery is invalid.
**Example**
```js
const delivery = await store.delivery.create(42, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
// => { id, number, type, entityId, 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**
```js
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, date: string, lines: Array<object>}>` — The delivery.
**Throws**
`Error` — If the delivery is not found.
**Example**
```js
const delivery = await store.delivery.getById(42, 5);
// => { id, number, type, entityId, 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, date: string}>>` — The deliveries.
**Example**
```js
const deliveries = await store.delivery.list(42);
// => [{ id, number, type, entityId, 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.lines]` | `Array<object>` | The new delivery lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number, date: string, lines: Array<object>}>` — The updated delivery.
**Throws**
`Error` — If the delivery is not found.
**Example**
```js
const delivery = await store.delivery.update(42, 5, { number: 'D-2', lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }
```