This commit is contained in:
seb
2026-10-14 20:50:07 +02:00
parent 9c54a8a1d3
commit d880273629
34 changed files with 4454 additions and 2695 deletions

View File

@@ -0,0 +1,38 @@
# `GET /order/{id}/file/{fileId}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get order attachment file content
Returns the full binary content of an attached file (e.g. order PDF)
for the specified order. Supports HTTP caching via ETag (SHA-256 hash) and 304 Not Modified.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Order ID |
| `fileId` | yes | integer | File ID or attachment ID |
## Query parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `download` | no | boolean | When true, sets Content-Disposition to attachment instead of inline |
## Response `200`
Binary file content
## Errors
| Status | Description |
|--------|-------------|
| 304 | Not modified |
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 404 | Order or file not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,58 @@
# `POST /order/{id}/pdf`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Generate and attach order PDF
Generates an A4 PDF document for the sales order with line items, prices, and tax breakdown.
Attaches the PDF as a `manifestattachment` to the order so it can be printed or archived.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Order ID |
## Signals
On success, emits SSE signal: `order` (see [`GET /events`](../events.md)).
## Response `201`
PDF generated and attached to order
```json
{
"attachment": {
"id": 1,
"manifestId": 1,
"fileId": 1,
"sort": 1,
"hash": "…",
"mimetype": "…",
"name": "…",
"size": 1,
"created": "2026-08-10T00:00:00.000Z",
"modified": "2026-08-10T00:00:00.000Z",
"thumbavif": "…",
"thumbx": 1,
"thumby": 1,
"meta": {}
},
"fileUrl": "/order/1/file/5"
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Order not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -52,6 +52,24 @@ List of shipments
"type": "…",
"state": "…"
}
],
"files": [
{
"id": 1,
"manifestId": 1,
"fileId": 1,
"sort": 1,
"hash": "…",
"mimetype": "…",
"name": "…",
"size": 1,
"created": "2026-08-10T00:00:00.000Z",
"modified": "2026-08-10T00:00:00.000Z",
"thumbavif": "…",
"thumbx": 1,
"thumby": 1,
"meta": {}
}
]
}
]

View File

@@ -89,6 +89,24 @@ Created shipment
"type": "…",
"state": "…"
}
],
"files": [
{
"id": 1,
"manifestId": 1,
"fileId": 1,
"sort": 1,
"hash": "…",
"mimetype": "…",
"name": "…",
"size": 1,
"created": "2026-08-10T00:00:00.000Z",
"modified": "2026-08-10T00:00:00.000Z",
"thumbavif": "…",
"thumbx": 1,
"thumby": 1,
"meta": {}
}
]
}
}