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.
This commit is contained in:
@@ -10,7 +10,7 @@ Creates a new delivery for a company with its lines.
|
||||
|
||||
```js
|
||||
const fn = create(pool);
|
||||
const delivery = await fn(42, 1, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
|
||||
const delivery = await fn(42, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
|
||||
@@ -22,7 +22,7 @@ Deletes a delivery by its id within a company.
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 1, 5);
|
||||
await fn(42, 5);
|
||||
```
|
||||
|
||||
## `delivery.getById`
|
||||
@@ -33,7 +33,7 @@ Returns a single delivery by its id within a company.
|
||||
|
||||
```js
|
||||
const fn = getById(pool);
|
||||
const delivery = await fn(42, 1, 5);
|
||||
const delivery = await fn(42, 5);
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
|
||||
@@ -45,7 +45,7 @@ Lists the deliveries of a company.
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const deliveries = await fn(42, 1);
|
||||
const deliveries = await fn(42);
|
||||
// => [{ id, number, type, entityId, date }]
|
||||
```
|
||||
|
||||
@@ -57,6 +57,6 @@ Updates a delivery's header and/or lines.
|
||||
|
||||
```js
|
||||
const fn = update(pool);
|
||||
const delivery = await fn(42, 1, 5, { number: 'D-2', lines: [...] });
|
||||
const delivery = await fn(42, 5, { number: 'D-2', lines: [...] });
|
||||
// => { id, number, type, entityId, date, lines: [...] }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user