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 /quote/{id}/file/{fileId}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Get quote attachment file content
Returns the full binary content of an attached file (e.g. quote PDF)
for the specified quote. Supports HTTP caching via ETag (SHA-256 hash) and 304 Not Modified.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Quote 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 | Quote 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 /quote/{id}/pdf`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Generate and attach quote PDF
Generates an A4 PDF document for the quote with prices, net sum, and tax breakdown.
Stores the PDF as a `manifestattachment` for printing or downloading.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Quote ID |
## Signals
On success, emits SSE signal: `quote` (see [`GET /events`](../events.md)).
## Response `201`
PDF generated and attached to quote
```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": "/quote/1/file/5"
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid ID or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Quote not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -66,6 +66,24 @@ Created quote
"taxrate": 1,
"comment": "…"
}
],
"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

@@ -41,6 +41,24 @@ Quote
"taxrate": 1,
"comment": "…"
}
],
"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

@@ -47,6 +47,24 @@ Quote list
"taxrate": 1,
"comment": "…"
}
],
"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

@@ -60,6 +60,24 @@ Updated quote
"taxrate": 1,
"comment": "…"
}
],
"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": {}
}
]
}
}