This commit is contained in:
seb
2026-08-02 19:04:56 +02:00
parent bfb1d8762a
commit aed0857f23
21 changed files with 1953 additions and 0 deletions

30
TODO.md Normal file
View File

@@ -0,0 +1,30 @@
# TODO — nächster Schritt (Brands / Artikelfelder)
Geschwister: **dashdbschema** hat `libdashstore` um folgende Store-Methoden erweitert (alle authenticated, `googleAuthId` = eingeloggter User). Die Brand-Store-API existiert bereits. Das HTTP-Layer + OpenAPI-Doku hier in dashback ist **umgesetzt** — **dashfront** kann die UI bauen.
## Store-Methoden + HTTP-Routen (in dashback verdrahtet)
**`companyId` kommt immer aus der Auth-Session** (`req.user.selectedCompanyId`) — keine explizite `companyId` in Pfad/Query/Body, wie bei den Unit-Routen.
### `article` (alle liefern dasselbe Shape wie `getBySku`)
| Store-Methode | HTTP-Route | Args |
| --- | --- | --- |
| `setEansBySku` | `PUT /api/article/:sku/eans` | `(googleAuthId, sku, string[])` — replace-all |
| `setBrandIdBySku` | `PUT /api/article/:sku/brand` | `(googleAuthId, sku, brandId \| null)` |
| `setWeightBySku` | `PUT /api/article/:sku/weight` | `(googleAuthId, sku, weight)` |
| `setCategoryIdsBySku` | `PUT /api/article/:sku/categories` | `(googleAuthId, sku, number[])` — replace-all |
| `getBySku` | `GET /api/article/:sku` | liefert `eans`, `categoryIds`, `weight`, `brand` bereits mit |
### `brand` (verdrahtet)
| Store-Methode | HTTP-Route | Args |
| --- | --- | --- |
| `brand.list` | `GET /api/brand` | `(googleAuthId, selectedCompanyId)` |
| `brand.upsert` | `PUT /api/brand` | `(googleAuthId, selectedCompanyId, { name, gsprpinfo? })` |
| `brand.delete` | `DELETE /api/brand/:id` | `(googleAuthId, selectedCompanyId, id)` — Fehler `Brand in use`, wenn noch Artikel referenzieren |
## Umgesetzt
1. Routen unter `docs/api/routes/` + OpenAPI via `@openapi` JSDoc angelegt (stil wie existing routes).
2. Auth-Integration: `googleAuthId` aus Session bezogen (wie bestehende Routen).
3. Company-Scope: `selectedCompanyId` aus Session; Methoden validieren selbst (`Company not found` / `Not authorized` / etc.).
4. `npm run docs:api` regenerieren.
5. `README.md` (dashback) mit neuen Endpoints ergänzen.