This commit is contained in:
seb
2026-09-27 22:01:47 +02:00
parent 68b793c9ba
commit d2aa9ff8b1
11 changed files with 1553 additions and 1 deletions

View File

@@ -0,0 +1,65 @@
# `POST /labeltemplate`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create label template
Creates a new ZPL label template for the selected company.
A 50×50 1-bit PNG thumbnail is automatically rendered from the content and stored with the template.
## Body (JSON)
```json
{
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {
"objects": []
}
}
```
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `name` | yes | string | Template name |
| `width` | yes | integer | Canvas width in pixels |
| `height` | yes | integer | Canvas height in pixels |
| `dpi` | yes | integer | Printer DPI — `203` or `300` |
| `type` | yes | string | Template type — `"zpl"` |
| `content` | yes | object | Label editor JSON content |
## Response `201`
Created label template
```json
{
"labeltemplate": {
"id": 1,
"company_id": 1,
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {},
"thumb": "…"
}
}
```
`thumb` is a base64-encoded 50×50 1-bit PNG string, or `null` if rendering failed.
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,31 @@
# `DELETE /labeltemplate/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete label template
Deletes a label template for the authenticated user's selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Label template ID |
## Response `204`
Label template deleted
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 404 | Label template not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,45 @@
# `GET /labeltemplate/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get label template by ID
Retrieves a single label template for the authenticated user's selected company. The `thumb` field is always included inline as a base64-encoded 50×50 1-bit PNG string (`null` if not yet rendered).
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Label template ID |
## Response `200`
Label template details
```json
{
"labeltemplate": {
"id": 1,
"company_id": 1,
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {},
"thumb": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 404 | Label template not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,40 @@
# `GET /labeltemplate`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List label templates
Lists all ZPL label templates for the selected company. The `thumb` field is always included inline as a base64-encoded 50×50 1-bit PNG string (`null` if not yet rendered).
## Response `200`
List of label templates
```json
{
"labeltemplates": [
{
"id": 1,
"company_id": 1,
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {},
"thumb": "…"
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,74 @@
# `PATCH /labeltemplate/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update label template (partial)
Updates specified fields of an existing label template for the selected company.
When `content`, `width`, or `height` is provided, the thumbnail is automatically re-rendered.
Also available as `PUT /labeltemplate/{id}`.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Label template ID |
## Body (JSON)
All fields are optional.
```json
{
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {
"objects": []
}
}
```
| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Template name |
| `width` | integer | Canvas width in pixels |
| `height` | integer | Canvas height in pixels |
| `dpi` | integer | Printer DPI — `203` or `300` |
| `type` | string | Template type — `"zpl"` |
| `content` | object | Label editor JSON content |
## Response `200`
Updated label template
```json
{
"labeltemplate": {
"id": 1,
"company_id": 1,
"name": "…",
"width": 448,
"height": 200,
"dpi": 203,
"type": "zpl",
"content": {},
"thumb": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 404 | Label template not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._