This commit is contained in:
seb
2026-09-28 06:50:10 +02:00
parent 87da854de4
commit 5d2c8fdfed
3 changed files with 27 additions and 12 deletions

View File

@@ -18,9 +18,9 @@ Creates a new label template for the user's selected company.
| `input.width` | `number` | Canvas width in pixels. |
| `input.height` | `number` | Canvas height in pixels. |
| `input.dpi` | `number` | Printer DPI (203 or 300). |
| `input.type` | `string` | Template type (`"zpl"`). |
| `input.content` | `object` | Template content (JSON — label editor objects). |
| `[input.thumb]` | `Buffer\|null` | Optional pre-rendered 50×50 1-bit PNG thumbnail. |
| `input.type` | `string` | Template type ("zpl"). |
| `input.content` | `object` | Template content (JSON). |
| `[input.thumb]` | `Buffer|null` | 50×50 1-bit PNG thumbnail buffer. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
@@ -29,7 +29,7 @@ Creates a new label template for the user's selected company.
**Throws**
`Error` — If name, content or dimensions are missing, or dpi/type is invalid.
`Error` — If required fields are missing or invalid.
**Example**
@@ -88,14 +88,13 @@ Retrieves a label template by its ID for the user's selected company.
```js
const template = await store.labeltemplate.getById(googleAuthId, 1);
// => { id: 1, company_id: 1, name: 'Product Label', width: 448, height: 200, dpi: 203, type: 'zpl', ... }
```
## `labeltemplate.list`
*Source: `src/store/labeltemplate/list.js`*
Lists all label templates for the user's selected company.
Lists all label templates for the user's selected company. `content.objects` is omitted to reduce payload size.
**Parameters**
@@ -112,7 +111,6 @@ Lists all label templates for the user's selected company.
```js
const templates = await store.labeltemplate.list(42);
// => [{ id: 1, company_id: 1, name: 'Product Label', ... }]
```
## `labeltemplate.update`
@@ -127,14 +125,14 @@ Updates a label template for the user's selected company.
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The label template ID to update. |
| `input` | `object` | Update payload (all fields optional). |
| `input` | `object` | Update payload. |
| `[input.name]` | `string` | Template name. |
| `[input.width]` | `number` | Canvas width in pixels. |
| `[input.height]` | `number` | Canvas height in pixels. |
| `[input.dpi]` | `number` | Printer DPI (203 or 300). |
| `[input.type]` | `string` | Template type (`"zpl"`). |
| `[input.type]` | `string` | Template type ("zpl"). |
| `[input.content]` | `object` | Template content (JSON). |
| `[input.thumb]` | `Buffer\|null` | 50×50 1-bit PNG thumbnail. |
| `[input.thumb]` | `Buffer|null` | 50×50 1-bit PNG thumbnail buffer. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
@@ -143,4 +141,4 @@ Updates a label template for the user's selected company.
**Throws**
`Error` — If template not found, name is empty, or dpi/type is invalid.
`Error` — If template not found or input invalid.