This commit is contained in:
seb
2026-09-26 23:06:09 +02:00
parent cbb2fdeb6d
commit 69f27a2942
19 changed files with 2231 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
# `PUT /printer/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update printer
Updates specified fields of an existing printer for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Printer ID |
## Body (JSON)
```json
{
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
```
## Response `200`
Updated printer
```json
{
"printer": {
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Printer not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,53 @@
# `POST /printer`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Create printer
Creates a new printer for the selected company.
`type` must be `"esc/pos"` (lines) or `"zpl"` (pages).
## Body (JSON)
```json
{
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
```
## Response `201`
Created printer
```json
{
"printer": {
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

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

View File

@@ -0,0 +1,45 @@
# `GET /printer/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get printer by ID
Retrieves a single printer for the authenticated user's selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Printer ID |
## Response `200`
Printer details
```json
{
"printer": {
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Printer not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,40 @@
# `GET /printer`
Protected. Requires a valid session cookie (`credentials: 'include'`).
List printers
Lists printers for the selected company, ordered by sort and id.
## Response `200`
List of printers
```json
{
"printers": [
{
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,43 @@
# `PUT /printer/order`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Reorder printers
Reorders printers for the selected company.
`printerIds` must include all existing printer IDs exactly once.
## Body (JSON)
```json
{
"printerIds": [
1
]
}
```
## Response `200`
Applied printer order
```json
{
"printerIds": [
1
]
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid printer order or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,58 @@
# `PATCH /printer/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update printer (partial)
Updates specified fields of an existing printer for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Printer ID |
## Body (JSON)
```json
{
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
```
## Response `200`
Updated printer
```json
{
"printer": {
"id": 1,
"company_id": 1,
"address": "…",
"type": "esc/pos",
"model": "…",
"serial": "…",
"sort": 1,
"desc": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Printer not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._