This commit is contained in:
seb
2026-10-29 03:28:39 +01:00
parent 75a83bdc28
commit 0fb5893a70
6 changed files with 165 additions and 17 deletions

View File

@@ -45,7 +45,7 @@ Finds a posterminal by its pairingpin.
**Returns**
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string}|null>` — The posterminal, or null if not found.
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string, sort: number, enabled: boolean|number, clientversion: string|null}|null>` — The posterminal, or null if not found.
## `posterminal.findByToken`
@@ -62,7 +62,7 @@ Finds a posterminal by its auth token.
**Returns**
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string}|null>` — The posterminal, or null if not found.
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string, sort: number, enabled: boolean|number, clientversion: string|null}|null>` — The posterminal, or null if not found.
## `posterminal.getCategoryCount`
@@ -311,13 +311,13 @@ Lists the posterminals of the user's selected company.
**Returns**
`Promise<Array<{id: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string}>>` — The posterminals.
`Promise<Array<{id: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, maxknownobituaryid: number|null, rootCategoryId: number|null, syncRootArticles: boolean|number, lastseenAt: string|null, updatedAt: string, sort: number, enabled: boolean|number, clientversion: string|null}>>` — The posterminals.
**Example**
```js
const terminals = await store.posterminal.list(42);
// => [{ id, name, token, pairingpin, pairedAt, clientserial, maxknownobituaryid, rootCategoryId, syncRootArticles, lastseenAt, updatedAt }]
// => [{ id, name, token, pairingpin, pairedAt, clientserial, maxknownobituaryid, rootCategoryId, syncRootArticles, lastseenAt, updatedAt, sort, enabled, clientversion }]
```
## `posterminal.pair`
@@ -335,11 +335,12 @@ Completes POS device pairing for a terminal.
| `input.token` | `string` | The auth token for the paired device. |
| `[input.clientserial]` | `string` | The client name or serial identifier. |
| `[input.pairedAt]` | `string` | Timestamp when paired. |
| `[input.clientversion]` | `string|null` | Client software version reported by the POS device during pairing. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, token: string, clientserial: string|null, pairedAt: string|null}>`
`Promise<{id: number, token: string, clientserial: string|null, pairedAt: string|null, clientversion: string|null}>`
## `posterminal.recordObituary`
@@ -381,6 +382,31 @@ Enqueues a sync notification for all POS terminals of a company.
`Promise<void>`
## `posterminal.setClientversion`
*Source: `src/store/posterminal/setClientversion.js`*
Stores the software version reported by a POS terminal.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `id` | `number` | The posterminal id. |
| `clientversion` | `string|null` | Version string reported by the client (trimmed; empty → null). |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, clientversion: string|null}>`
**Example**
```js
await store.posterminal.setClientversion(7, '1.10.12.0');
// => { id: 7, clientversion: '1.10.12.0' }
```
## `posterminal.setMaxKnownObituaryId`
*Source: `src/store/posterminal/setMaxKnownObituaryId.js`*
@@ -550,11 +576,13 @@ Creates or updates a posterminal for the user's selected company.
| `input.pairingpin` | `string` | The pairing pin. |
| `[input.token]` | `string` | Optional token. |
| `[input.id]` | `number` | Optional id to update an existing posterminal. |
| `[input.sort]` | `number` | Display order (integer, ascending). Default 0 on create. |
| `[input.enabled]` | `boolean` | Whether the terminal may sync. Default true on create. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, name: string, token: string, pairingpin: string}>` — The upserted posterminal.
`Promise<{id: number, name: string, token: string, pairingpin: string, sort: number, enabled: number}>` — The upserted posterminal.
**Throws**
@@ -564,5 +592,5 @@ Creates or updates a posterminal for the user's selected company.
```js
const terminal = await store.posterminal.upsert(42, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
// => { id, name, token, pairingpin }
// => { id, name, token, pairingpin, sort, enabled }
```