This commit is contained in:
seb
2026-10-08 02:53:32 +02:00
parent cd396363bd
commit 73461c6e6f
6 changed files with 751 additions and 2 deletions

View File

@@ -104,6 +104,7 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
| [`routes/company/create.md`](routes/company/create.md) | `POST /company` |
| [`routes/company/history.md`](routes/company/history.md) | `GET /company/history` |
| [`routes/company/addHistory.md`](routes/company/addHistory.md) | `POST /company/history` |
| [`routes/company/import.md`](routes/company/import.md) | `POST /company/import` |
| [`routes/companysetting/list.md`](routes/companysetting/list.md) | `GET /company/setting` |
| [`routes/companysetting/get.md`](routes/companysetting/get.md) | `GET /company/setting/{key}` |
| [`routes/companysetting/set.md`](routes/companysetting/set.md) | `PUT /company/setting/{key}` |

View File

@@ -1,6 +1,6 @@
# Dash API Routes Overview (All)
Overview of all 190 API endpoints across all modules.
Overview of all 191 API endpoints across all modules.
### Notation
@@ -273,6 +273,9 @@ _none_
#### Add company history entry — `POST /company/history`
- Params: `body: { text: str }`
- Returns: `201 { history: { id: int, date: str, text: str, companyuserId?: int|null } }`
#### Import company catalog from zip archive (SSE) — `POST /company/import`
- Params: `form: { file?: str }`
- Returns: `200 SSE`
#### List company settings — `GET /company/setting`
_none_
- Returns: `200 { settings: { key: str, value: str|null }[] }`

View File

@@ -1,6 +1,6 @@
# Dash API Routes Overview
Overview of all 145 API endpoints across all modules.
Overview of all 146 API endpoints across all modules.
### Notation
@@ -247,6 +247,9 @@ _none_
#### Add company history entry — `POST /company/history`
- Params: `body: { text: str }`
- Returns: `201 { history: { id: int, date: str, text: str, companyuserId?: int|null } }`
#### Import company catalog from zip archive (SSE) — `POST /company/import`
- Params: `form: { file?: str }`
- Returns: `200 SSE`
#### List company settings — `GET /company/setting`
_none_
- Returns: `200 { settings: { key: str, value: str|null }[] }`

View File

@@ -0,0 +1,41 @@
# `POST /company/import`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Import company catalog from zip archive (SSE)
Uploads a .zip archive containing company export data (categories, articles, pictures),
preserves archive contents under `data/import/<companyId>/`, and executes full catalog
import (categories hierarchy, articles upsert, variant linking, image processing).
Streams progress events via Server-Sent Events (`text/event-stream`).
## Body (`multipart/form-data`)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `file` | no | file | ZIP archive (.zip) containing company data |
## Response `200`
Import progress stream (`text/event-stream`) or JSON result
```json
{
"ok": true,
"message": "Import erfolgreich abgeschlossen.",
"stats": {}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Bad request (missing file, not a zip, or no company selected) — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 500 | Server error — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._