u
This commit is contained in:
8
TODO.md
8
TODO.md
@@ -13,6 +13,7 @@
|
||||
| Brand setzen / entfernen | `PUT /api/article/:sku/brand` | `{ brandId: number \| null }` | `{ article }` (Detail) |
|
||||
| Gewicht setzen | `PUT /api/article/:sku/weight` | `{ weight: number }` | `{ article }` (Detail) |
|
||||
| Kategorien setzen (replace-all) | `PUT /api/article/:sku/categories` | `{ categoryIds: number[] }` | `{ article }` (Detail) |
|
||||
| Kategorie umbenennen | `PATCH /api/category/:id` | `{ name }` | `{ category: { id, name, slug } }` |
|
||||
| Detail liefert neue Felder | `GET /api/article/:sku` | – | `{ article }` mit `eans`, `categoryIds`, `weight`, `brand` |
|
||||
|
||||
`Brand` = `{ id, name, gsprpinfo \| null }`.
|
||||
@@ -23,7 +24,7 @@ Alle PUT/PATCH-Endpoints der Artikel liefern dasselbe Shape wie `GET /api/articl
|
||||
|
||||
### API-Client (`src/api/index.js`)
|
||||
- Alle Calls über den bestehenden Client (`credentials: 'include'`) — Frontend spricht nur HTTP, nie direkt den Store.
|
||||
- Neuen Methoden für: `brand.list` / `brand.upsert` / `brand.delete` und `article.setEansBySku` / `article.setBrandIdBySku` / `article.setWeightBySku` / `article.setCategoryIdsBySku`.
|
||||
- Neuen Methoden für: `brand.list` / `brand.upsert` / `brand.delete` und `article.setEansBySku` / `article.setBrandIdBySku` / `article.setWeightBySku` / `article.setCategoryIdsBySku` sowie `category.rename`.
|
||||
- **Kein `companyId` in Request/Pfad/Query senden** — die Company kommt aus der Session.
|
||||
|
||||
### Brand-UI
|
||||
@@ -37,12 +38,14 @@ Alle PUT/PATCH-Endpoints der Artikel liefern dasselbe Shape wie `GET /api/articl
|
||||
- **Brand**: Dropdown aus `GET /api/brand`; „Keine Brand“ ⇒ `brandId: null`. Deal nur mit Brands derselben Company (sonst `404 Brand not found`).
|
||||
- **Gewicht**: Zahlenfeld, `>= 0`. `400 Invalid weight` sonst.
|
||||
- **Kategorien**: Mehrfachauswahl aus der Category-Tree; nur Kategorien derselben Company (sonst `400 Invalid categoryIds`). Leere Liste entfernt alle.
|
||||
- **Kategorie umbenennen**: Inline/Formular im Category-Tree → `PATCH /api/category/:id` mit `{ name }`. Leeres `name` ⇒ `400 Name required`. Nach Save das zurückgegebene `{ id, name, slug }` im Baum aktualisieren.
|
||||
- Nach jedem Save das zurückgegebene Detail-Objekt in den Store übernehmen.
|
||||
|
||||
### Fehlerbehandlung
|
||||
- Fehler als Toast/Formular-Fehler abbilden:
|
||||
- `Brand in use` (409), `Invalid eans` / `Invalid weight` / `Invalid categoryIds` / `Invalid brand` (400)
|
||||
- `Brand not found` / `Article not found` (404)
|
||||
- `Brand not found` / `Article not found` / `Category not found` (404)
|
||||
- `Name required` (400) bei leerem Kategorienamen
|
||||
- `No company selected` (400) → Company-Wechsel-Flow
|
||||
- `Not authorized` (403)
|
||||
|
||||
@@ -50,4 +53,5 @@ Alle PUT/PATCH-Endpoints der Artikel liefern dasselbe Shape wie `GET /api/articl
|
||||
- API-Doku: `../dashback/docs/api/README.md` und `../dashback/docs/api/routes/`
|
||||
- `brand/list.md`, `brand/upsert.md`, `brand/delete.md`
|
||||
- `article/set-eans.md`, `article/set-brand.md`, `article/set-weight.md`, `article/set-categories.md`
|
||||
- `category/rename.md`
|
||||
- Company-Scope: `google_auth.setSelectedCompany` (Store) — siehe `../dashdbschema/README.md`.
|
||||
|
||||
Reference in New Issue
Block a user