This commit is contained in:
seb
2026-10-14 00:21:31 +02:00
parent 74b24686bc
commit f9ed4fe75d
18 changed files with 1508 additions and 279 deletions

View File

@@ -12,8 +12,240 @@ Backup service status and listing
```json
{
"status": {},
"backups": {}
"status": {
"enabled": true,
"isRunning": true,
"dbProvider": "…",
"mssqlWarning": true,
"backupDir": "…",
"retention": {
"hourlyMax": 1,
"dailyMax": 1,
"monthly": "…"
},
"counts": {
"hourly": 1,
"daily": 1,
"monthly": 1
},
"latestHourly": {
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
},
"latestDaily": {
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
},
"latestMonthly": {
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
}
},
"backups": {
"counts": {
"hourly": 1,
"daily": 1,
"monthly": 1
},
"hourly": [
{
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
}
],
"daily": [
{
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
}
],
"monthly": [
{
"name": "…",
"path": "…",
"totalSizeBytes": 1,
"timestamp": "2026-08-10T00:00:00.000Z",
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
}
]
}
}
```
@@ -21,7 +253,7 @@ Backup service status and listing
| Status | Description |
|--------|-------------|
| 500 | Internal error |
| 500 | Internal error — `{"error":"…"}` |
---

View File

@@ -11,14 +11,53 @@ Immediately triggers an on-demand backup snapshot of VFS, storage, and SQLite da
Backup triggered successfully
```json
{}
{
"success": true,
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"promotedDaily": true,
"promotedMonthly": true,
"totalSizeBytes": 1,
"pruneResult": {
"hourlyPruned": 1,
"dailyPruned": 1
},
"manifest": {
"id": "…",
"timestamp": "2026-08-10T00:00:00.000Z",
"dateKey": "…",
"monthKey": "…",
"dbProvider": "…",
"manual": true,
"files": {
"vfs": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"storage": {
"name": "…",
"sizeBytes": 1,
"sourceExists": true
},
"database": {
"name": "…",
"sizeBytes": 1,
"backedUp": true,
"reason": "…"
}
},
"totalSizeBytes": 1,
"durationMs": 1
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 500 | Backup execution failure |
| 500 | Backup execution failure — `{"error":"…"}` |
---

View File

@@ -44,6 +44,8 @@ richer payload.
| `modelconversation` | `{}` | `POST /modelconversation`, `DELETE /modelconversation/{id}` |
| `modelconversation-<id>` | `{}` | Conversation-specific updates on the same model conversation thread; the concrete ID is used in the event name |
| `brand` | `{ sender, brandId }` | `POST /brand`, `PATCH /brand/{id}`, `DELETE /brand/{id}`, `POST /brand/{id}/image`, `DELETE /brand/{id}/image` |
| `draft` | `{ sender, action, name, content }` | Draft update on `drafts/quote`, `drafts/order`, `drafts/delivery` (`sender` echoes the caller's `x-client-id`) |
| `draft:request` | `{ requestId, action, name, target, sender }` | Server request to frontend to read a draft or list drafts |
The `brand` payload is `{ sender, brandId }`: `sender` echoes the
caller's `x-client-id` header (empty string if absent) so the sender

View File

@@ -0,0 +1,48 @@
# `POST /vfs/drafts/response`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Respond to a frontend draft request
Used by the frontend to answer a server-initiated `draft:request` SSE event
when reading or listing virtual drafts (`drafts/quote`, `drafts/order`, `drafts/delivery`).
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `requestId` | yes | string | Unique request ID from the draft:request SSE event |
| `content` | no | | File content when action was read |
| `error` | no | string | Error message if draft retrieval failed on frontend |
| `files` | no | any[] | File listing when action was list |
```json
{
"requestId": "…",
"content": "…",
"error": "…",
"files": []
}
```
## Response `200`
Response received and resolved
```json
{
"success": true
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing requestId or no company selected — `{"error":"…"}` |
| 404 | Request ID not found or already timed out — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._