Files
dashlibstorage/API.delivery.md
seb 70e0a9ddc4 Add entity customer numbers and scope APIs via selected company.
Entity gets an optional unique-per-company number with allocate/peek/isNumberFree helpers. Company-scoped store methods no longer take companyId and resolve google_auth.selected_company instead.
2026-08-07 04:29:35 +02:00

63 lines
1.3 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 a company with its lines.
```js
const fn = create(pool);
const delivery = await fn(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 a company.
```js
const fn = del(pool);
await fn(42, 5);
```
## `delivery.getById`
*Source: `src/store/delivery/getById.js`*
Returns a single delivery by its id within a company.
```js
const fn = getById(pool);
const delivery = await fn(42, 5);
// => { id, number, type, entityId, date, lines: [...] }
```
## `delivery.list`
*Source: `src/store/delivery/list.js`*
Lists the deliveries of a company.
```js
const fn = list(pool);
const deliveries = await fn(42);
// => [{ id, number, type, entityId, date }]
```
## `delivery.update`
*Source: `src/store/delivery/update.js`*
Updates a delivery's header and/or lines.
```js
const fn = update(pool);
const delivery = await fn(42, 5, { number: 'D-2', lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }
```