569 lines
16 KiB
Markdown
569 lines
16 KiB
Markdown
# posterminal
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `posterminal.delete`
|
|
|
|
*Source: `src/store/posterminal/delete.js`*
|
|
|
|
Deletes a posterminal by its id within the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The id of the posterminal to delete. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
await store.posterminal.delete(42, 5);
|
|
```
|
|
|
|
## `posterminal.findByPairingpin`
|
|
|
|
*Source: `src/store/posterminal/findByPairingpin.js`*
|
|
|
|
Finds a posterminal by its pairingpin.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `pairingpin` | `string` | The pairing pin to search for. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**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.
|
|
|
|
## `posterminal.findByToken`
|
|
|
|
*Source: `src/store/posterminal/findByToken.js`*
|
|
|
|
Finds a posterminal by its auth token.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `token` | `string` | The auth token to search for. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**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.
|
|
|
|
## `posterminal.getCategoryCount`
|
|
|
|
*Source: `src/store/posterminal/getCategoryCount.js`*
|
|
|
|
Counts categories assigned to the POS terminal queued after the given sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — The count of changed records.
|
|
|
|
## `posterminal.getCategoryList`
|
|
|
|
*Source: `src/store/posterminal/getCategoryList.js`*
|
|
|
|
Lists categories for a POS terminal queued after the sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[input.limit=20]` | `number` | Max items to return. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<object>>`
|
|
|
|
## `posterminal.getCompositeProductCount`
|
|
|
|
*Source: `src/store/posterminal/getCompositeProductCount.js`*
|
|
|
|
Counts composite products (Stücklisten) assigned to the POS terminal queued after the given sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — The count of changed records.
|
|
|
|
## `posterminal.getCustomerCount`
|
|
|
|
*Source: `src/store/posterminal/getCustomerCount.js`*
|
|
|
|
Counts customers of the POS terminal company queued after the given sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — The count of changed records.
|
|
|
|
## `posterminal.getCustomerGroupCount`
|
|
|
|
*Source: `src/store/posterminal/getCustomerGroupCount.js`*
|
|
|
|
Counts customer groups of the POS terminal company queued after the given sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — The count of changed records.
|
|
|
|
## `posterminal.getCustomerGroupList`
|
|
|
|
*Source: `src/store/posterminal/getCustomerGroupList.js`*
|
|
|
|
Lists customer groups for a POS terminal queued after the sync queue cursor ID, excluding 'Lieferanten'.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[input.limit=50]` | `number` | Max items to return. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<{customerGroupId: string, name: string, standard: string, discountPercent: string, lastChanged: string}>>`
|
|
|
|
## `posterminal.getCustomerList`
|
|
|
|
*Source: `src/store/posterminal/getCustomerList.js`*
|
|
|
|
Lists customers for a POS terminal queued after the sync queue cursor ID, excluding 'Lieferanten'.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[input.limit=20]` | `number` | Max items to return. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<object>>`
|
|
|
|
## `posterminal.getDeletedEntityCount`
|
|
|
|
*Source: `src/store/posterminal/getDeletedEntityCount.js`*
|
|
|
|
Counts deleted entities for a POS terminal after the given cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | The highest synced obituary ID. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — Count of deleted entities.
|
|
|
|
## `posterminal.getDeletedEntityList`
|
|
|
|
*Source: `src/store/posterminal/getDeletedEntityList.js`*
|
|
|
|
Lists deleted entities for a POS terminal after the given cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | The highest synced obituary ID. |
|
|
| `[input.limit=200]` | `number` | Max items to return. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<{id: number, entityType: string, entityId: number}>>`
|
|
|
|
## `posterminal.getMaxOrderIdCount`
|
|
|
|
*Source: `src/store/posterminal/getMaxOrderIdCount.js`*
|
|
|
|
Returns the maximum order manifest id for the POS terminal company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — Maximum order id or 0.
|
|
|
|
## `posterminal.getProductCount`
|
|
|
|
*Source: `src/store/posterminal/getProductCount.js`*
|
|
|
|
Counts products assigned to the POS terminal queued after the given sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<number>` — The count of changed records.
|
|
|
|
## `posterminal.getProductList`
|
|
|
|
*Source: `src/store/posterminal/getProductList.js`*
|
|
|
|
Lists products for a POS terminal queued after the sync queue cursor ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.posterminalId` | `number` | The POS terminal id. |
|
|
| `[input.cursor=0]` | `number` | Sequential ID cursor of last synced posterminalsyncqueue entry. |
|
|
| `[input.limit=20]` | `number` | Max items to return. |
|
|
| `[tx]` | `object` | Optional transaction. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<object>>`
|
|
|
|
## `posterminal.list`
|
|
|
|
*Source: `src/store/posterminal/list.js`*
|
|
|
|
Lists the posterminals of the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**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.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const terminals = await store.posterminal.list(42);
|
|
// => [{ id, name, token, pairingpin, pairedAt, clientserial, maxknownobituaryid, rootCategoryId, syncRootArticles, lastseenAt, updatedAt }]
|
|
```
|
|
|
|
## `posterminal.pair`
|
|
|
|
*Source: `src/store/posterminal/pair.js`*
|
|
|
|
Completes POS device pairing for a terminal.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `id` | `number` | The posterminal id. |
|
|
| `input` | `object` | |
|
|
| `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. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, token: string, clientserial: string|null, pairedAt: string|null}>`
|
|
|
|
## `posterminal.recordObituary`
|
|
|
|
*Source: `src/store/posterminal/recordObituary.js`*
|
|
|
|
Records an obituary for all active paired POS terminals of a company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.companyId` | `number` | The company id. |
|
|
| `input.entityType` | `string` | 'category' | 'article' | 'customer' | 'customergroup' |
|
|
| `input.entityId` | `number` | The deleted entity's id. |
|
|
| `[tx]` | `object` | Optional transaction/runner. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
## `posterminal.recordSyncQueue`
|
|
|
|
*Source: `src/store/posterminal/recordSyncQueue.js`*
|
|
|
|
Enqueues a sync notification for all POS terminals of a company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.companyId` | `number` | The company id. |
|
|
| `input.entityType` | `string` | 'category' | 'article' | 'customer' | 'customergroup' |
|
|
| `input.entityId` | `number` | The entity's id. |
|
|
| `[tx]` | `object` | Optional transaction/runner. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
## `posterminal.setMaxKnownObituaryId`
|
|
|
|
*Source: `src/store/posterminal/setMaxKnownObituaryId.js`*
|
|
|
|
Updates the max known obituary ID for a POS terminal.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `id` | `number` | The posterminal id. |
|
|
| `maxknownobituaryid` | `number|null` | The highest synced obituary ID. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, maxknownobituaryid: number|null}>`
|
|
|
|
## `posterminal.setOff`
|
|
|
|
*Source: `src/store/posterminal/setOff.js`*
|
|
|
|
Removes a category assignment from a posterminal (turns it off).
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `posterminalId` | `number` | The id of the posterminal. |
|
|
| `categoryId` | `number` | The id of the category to remove. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with its remaining category ids.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const result = await store.posterminal.setOff(42, 5, 9);
|
|
// => { id, categoryIds: [...] }
|
|
```
|
|
|
|
## `posterminal.setOffAll`
|
|
|
|
*Source: `src/store/posterminal/setOffAll.js`*
|
|
|
|
Removes all category assignments from a posterminal.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `posterminalId` | `number` | The id of the posterminal. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with an empty category list.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const result = await store.posterminal.setOffAll(42, 5);
|
|
// => { id, categoryIds: [] }
|
|
```
|
|
|
|
## `posterminal.setOn`
|
|
|
|
*Source: `src/store/posterminal/setOn.js`*
|
|
|
|
Assigns a category to a posterminal (turns it on for that category).
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `posterminalId` | `number` | The id of the posterminal. |
|
|
| `categoryId` | `number` | The id of the category to assign. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with its category ids.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const result = await store.posterminal.setOn(42, 5, 9);
|
|
// => { id, categoryIds: [9, ...] }
|
|
```
|
|
|
|
## `posterminal.setOnAll`
|
|
|
|
*Source: `src/store/posterminal/setOnAll.js`*
|
|
|
|
Assigns all categories of the user's selected company to a posterminal.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `posterminalId` | `number` | The id of the posterminal. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with all category ids.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const result = await store.posterminal.setOnAll(42, 5);
|
|
// => { id, categoryIds: [...] }
|
|
```
|
|
|
|
## `posterminal.touchLastseen`
|
|
|
|
*Source: `src/store/posterminal/touchLastseen.js`*
|
|
|
|
Updates lastseen_at for a POS terminal to the current timestamp.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `id` | `number` | The posterminal id. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number}>`
|
|
|
|
## `posterminal.upsert`
|
|
|
|
*Source: `src/store/posterminal/upsert.js`*
|
|
|
|
Creates or updates a posterminal for the user's selected company.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `input` | `object` | The posterminal input. |
|
|
| `input.name` | `string` | The posterminal name. |
|
|
| `input.pairingpin` | `string` | The pairing pin. |
|
|
| `[input.token]` | `string` | Optional token. |
|
|
| `[input.id]` | `number` | Optional id to update an existing posterminal. |
|
|
| `[tx]` | `object` | Optional transaction to run within. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, name: string, token: string, pairingpin: string}>` — The upserted posterminal.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the posterminal is invalid.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const terminal = await store.posterminal.upsert(42, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
|
|
// => { id, name, token, pairingpin }
|
|
```
|