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:
seb
2026-08-07 04:29:35 +02:00
parent 1e89e19863
commit 70e0a9ddc4
78 changed files with 940 additions and 772 deletions

View File

@@ -10,7 +10,7 @@ Creates a new supplier for a company, recording history.
```js
const fn = create(pool);
const supplier = await fn(42, 1, { name: 'Acme Supplies' });
const supplier = await fn(42, { name: 'Acme Supplies' });
// => { id, name, createdAt, updatedAt }
```
@@ -22,7 +22,7 @@ Deletes a supplier by its id within a company.
```js
const fn = del(pool);
await fn(42, 1, 5);
await fn(42, 5);
```
## `supplier.list`
@@ -33,7 +33,7 @@ Lists the suppliers of a company.
```js
const fn = list(pool);
const suppliers = await fn(42, 1);
const suppliers = await fn(42);
// => [{ id, name, createdAt, updatedAt }]
```
@@ -45,6 +45,6 @@ Updates the name of a supplier, recording history.
```js
const fn = update(pool);
const supplier = await fn(42, 1, 5, { name: 'Acme GmbH' });
const supplier = await fn(42, 5, { name: 'Acme GmbH' });
// => { id, name, createdAt, updatedAt }
```