Files
dashlibstorage/API.numbers.md
2026-10-12 19:48:07 +02:00

61 lines
1.9 KiB
Markdown

# numbers
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `numbers.list`
*Source: `src/store/numbers/list.js`*
Lists the number sequences of the user's selected company. Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment') exist.
**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, type: string, prefix: string, padding: number, next: number}>>` — The number sequences.
**Example**
```js
const numbers = await store.numbers.list(42);
// => [{ id, type, prefix, padding, next }]
```
## `numbers.update`
*Source: `src/store/numbers/update.js`*
Updates the sequence settings of a number for the user's selected company. Only the provided fields are changed (all optional). `prefix` is trimmed and must be at most 50 characters. `padding` and `next` must be finite numbers greater than or equal to 0 and 1 respectively. If no field is provided, the row is returned unchanged.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The id of the number sequence to update. |
| `input` | `object` | The update input. |
| `[input.prefix]` | `string` | The new prefix. |
| `[input.padding]` | `number` | The new padding length. |
| `[input.next]` | `number` | The new next value. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, type: string, prefix: string, padding: number, next: number}>` — The updated number sequence.
**Throws**
`Error` — If the number is not found or a field is invalid.
**Example**
```js
const number = await store.numbers.update(42, 3, { prefix: 'A-', padding: 4, next: 100 });
// => { id, type, prefix, padding, next }
```