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 @@ Deletes a posterminal by its id within a company.
```js
const fn = del(pool);
await fn(42, 1, 5);
await fn(42, 5);
```
## `posterminal.list`
@@ -21,7 +21,7 @@ Lists the posterminals of a company.
```js
const fn = list(pool);
const terminals = await fn(42, 1);
const terminals = await fn(42);
// => [{ id, name, token, pairingpin }]
```
@@ -33,7 +33,7 @@ Removes a category assignment from a posterminal (turns it off).
```js
const fn = setOff(pool);
const result = await fn(42, 1, 5, 9);
const result = await fn(42, 5, 9);
// => { id, categoryIds: [...] }
```
@@ -45,7 +45,7 @@ Removes all category assignments from a posterminal.
```js
const fn = setOffAll(pool);
const result = await fn(42, 1, 5);
const result = await fn(42, 5);
// => { id, categoryIds: [] }
```
@@ -57,7 +57,7 @@ Assigns a category to a posterminal (turns it on for that category).
```js
const fn = setOn(pool);
const result = await fn(42, 1, 5, 9);
const result = await fn(42, 5, 9);
// => { id, categoryIds: [9, ...] }
```
@@ -69,7 +69,7 @@ Assigns all categories of a company to a posterminal.
```js
const fn = setOnAll(pool);
const result = await fn(42, 1, 5);
const result = await fn(42, 5);
// => { id, categoryIds: [...] }
```
@@ -81,6 +81,6 @@ Creates or updates a posterminal for a company.
```js
const fn = upsert(pool);
const terminal = await fn(42, 1, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
const terminal = await fn(42, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
// => { id, name, token, pairingpin }
```