u
This commit is contained in:
@@ -85,8 +85,9 @@ Generated from `@openapi` annotations in [`src/api/routes/`](../../src/api/route
|
||||
| [`routes/auth/me.md`](routes/auth/me.md) | `GET /auth/me` |
|
||||
| [`routes/auth/selected-company.md`](routes/auth/selected-company.md) | `PUT /auth/selected-company` |
|
||||
| [`routes/brand/list.md`](routes/brand/list.md) | `GET /brand` |
|
||||
| [`routes/brand/upsert.md`](routes/brand/upsert.md) | `PUT /brand` |
|
||||
| [`routes/brand/create.md`](routes/brand/create.md) | `POST /brand` |
|
||||
| [`routes/brand/delete.md`](routes/brand/delete.md) | `DELETE /brand/{id}` |
|
||||
| [`routes/brand/update.md`](routes/brand/update.md) | `PATCH /brand/{id}` |
|
||||
| [`routes/brand/_id/image.delete.md`](routes/brand/_id/image.delete.md) | `DELETE /brand/{id}/image` |
|
||||
| [`routes/brand/_id/image.post.md`](routes/brand/_id/image.post.md) | `POST /brand/{id}/image` |
|
||||
| [`routes/category/create.md`](routes/category/create.md) | `POST /category` |
|
||||
@@ -247,6 +248,7 @@ Clients subscribe via [`GET /events`](routes/events.md) (`text/event-stream`). A
|
||||
|--------|------------|
|
||||
| `article-<sku>` | `PUT /article/{sku}/brand`, `PUT /article/{sku}/categories`, `PUT /article/{sku}/eans`, `POST /article/{sku}/image`, `DELETE /article/{sku}/image/{fullHash}`, `PUT /article/{sku}/images/order`, `PUT /article/{sku}/prices`, `POST /article/{sku}/supplier`, `PUT /article/{sku}/supplier/order`, `DELETE /article/{sku}/supplier/{id}`, `PATCH /article/{sku}/supplier/{id}`, `PUT /article/{sku}/track_stock`, `PUT /article/{sku}/weight` |
|
||||
| `articles` | `POST /article`, `DELETE /article/{sku}`, `PATCH /article/{sku}`, `DELETE /category/{id}` |
|
||||
| `brand` | `POST /brand`, `DELETE /brand/{id}`, `PATCH /brand/{id}`, `DELETE /brand/{id}/image`, `POST /brand/{id}/image` |
|
||||
| `category` | `POST /category`, `PUT /category/order`, `DELETE /category/{id}`, `PATCH /category/{id}`, `DELETE /category/{id}/image`, `POST /category/{id}/image` |
|
||||
| `vfs` | `POST /vfs/mkdir`, `POST /vfs/rename`, `POST /vfs/upload`, `DELETE /vfs/{*path}`, `PUT /vfs/{*path}` |
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Dash API Routes Overview (All)
|
||||
|
||||
Overview of all 204 API endpoints across all modules.
|
||||
Overview of all 205 API endpoints across all modules.
|
||||
|
||||
### Notation
|
||||
|
||||
@@ -216,12 +216,15 @@ _none_
|
||||
#### List brands — `GET /brand`
|
||||
_none_
|
||||
- Returns: `200 { brands: { id: int, name: str, pics: T30[], gsprpinfo?: str|null }[] }`
|
||||
#### Upsert brand — `PUT /brand`
|
||||
#### Create brand — `POST /brand`
|
||||
- Params: `body: { name: str, gsprpinfo?: str }`
|
||||
- Returns: `200 { brand: { id: int, name: str, pics: T30[], gsprpinfo?: str|null } }`
|
||||
- Returns: `201 { brand: { id: int, name: str, pics: T30[], gsprpinfo?: str|null } }`
|
||||
#### Delete brand — `DELETE /brand/{id}`
|
||||
- Params: `id: int`
|
||||
- Returns: `204 void`
|
||||
#### Rename brand — `PATCH /brand/{id}`
|
||||
- Params: `id: int, body: { name?: str, gsprpinfo?: str }`
|
||||
- Returns: `200 { brand: { id: int, name: str, touchedArticleCount: int, gsprpinfo?: str|null } }`
|
||||
#### Delete brand image — `DELETE /brand/{id}/image`
|
||||
- Params: `id: int`
|
||||
- Returns: `200 { brand: { id: int, thumbW: int|null, thumbH: int|null, thumbHash: str|null, pics: T30[] } }`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Dash API Routes Overview
|
||||
|
||||
Overview of all 158 API endpoints across all modules.
|
||||
Overview of all 159 API endpoints across all modules.
|
||||
|
||||
### Notation
|
||||
|
||||
@@ -199,12 +199,15 @@ _none_
|
||||
#### List brands — `GET /brand`
|
||||
_none_
|
||||
- Returns: `200 { brands: { id: int, name: str, pics: T28[], gsprpinfo?: str|null }[] }`
|
||||
#### Upsert brand — `PUT /brand`
|
||||
#### Create brand — `POST /brand`
|
||||
- Params: `body: { name: str, gsprpinfo?: str }`
|
||||
- Returns: `200 { brand: { id: int, name: str, pics: T28[], gsprpinfo?: str|null } }`
|
||||
- Returns: `201 { brand: { id: int, name: str, pics: T28[], gsprpinfo?: str|null } }`
|
||||
#### Delete brand — `DELETE /brand/{id}`
|
||||
- Params: `id: int`
|
||||
- Returns: `204 void`
|
||||
#### Rename brand — `PATCH /brand/{id}`
|
||||
- Params: `id: int, body: { name?: str, gsprpinfo?: str }`
|
||||
- Returns: `200 { brand: { id: int, name: str, touchedArticleCount: int, gsprpinfo?: str|null } }`
|
||||
#### Delete brand image — `DELETE /brand/{id}/image`
|
||||
- Params: `id: int`
|
||||
- Returns: `200 { brand: { id: int, thumbW: int|null, thumbH: int|null, thumbHash: str|null, pics: T28[] } }`
|
||||
|
||||
@@ -4,7 +4,7 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Delete brand image
|
||||
|
||||
Removes the brand's image. Sets thumbW, thumbH, thumbHash back to null.
|
||||
Removes the brand's image. Sets thumbW, thumbH, thumbHash back to null. Emits SSE signal `brand` with payload `{ sender, brandId }`.
|
||||
|
||||
## Path parameters
|
||||
|
||||
@@ -12,6 +12,10 @@ Removes the brand's image. Sets thumbW, thumbH, thumbHash back to null.
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | Brand id |
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `200`
|
||||
|
||||
Image removed
|
||||
|
||||
@@ -5,7 +5,8 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
Add or replace brand image
|
||||
|
||||
Uploads an image for the brand (AVIF, WebP, or octet-stream). Converted to AVIF full and thumbnail.
|
||||
Replaces any existing image for this brand.
|
||||
Replaces any existing image for this brand. Emits SSE signal `brand`
|
||||
with payload `{ sender, brandId }`.
|
||||
|
||||
|
||||
## Path parameters
|
||||
@@ -22,6 +23,10 @@ Raw binary (`image/webp`).
|
||||
|
||||
Raw binary (`application/octet-stream`).
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `201`
|
||||
|
||||
Image stored and linked
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
# `PUT /brand`
|
||||
# `POST /brand`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Upsert brand
|
||||
Create brand
|
||||
|
||||
Insert or update brand by `name` for the selected company. `gsprpinfo` optional.
|
||||
Creates a brand for the selected company. Fails with `Brand already exists`
|
||||
if the name is taken. Emits SSE signal `brand` with payload
|
||||
`{ sender, brandId }` (`sender` echoes the caller's `x-client-id`).
|
||||
|
||||
|
||||
## Body (JSON)
|
||||
@@ -21,9 +23,13 @@ Insert or update brand by `name` for the selected company. `gsprpinfo` optional.
|
||||
}
|
||||
```
|
||||
|
||||
## Response `200`
|
||||
## Signals
|
||||
|
||||
Upserted brand
|
||||
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `201`
|
||||
|
||||
Created brand
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -53,6 +59,7 @@ Upserted brand
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 403 | Not authorized — `{"error":"…"}` |
|
||||
| 404 | Company not found — `{"error":"…"}` |
|
||||
| 409 | Brand already exists — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
@@ -5,7 +5,8 @@ Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
Delete brand
|
||||
|
||||
Deletes the brand for the selected company. Fails with `Brand in use`
|
||||
if any article still references it.
|
||||
if any article still references it. Emits SSE signal `brand`
|
||||
with payload `{ sender, brandId }`.
|
||||
|
||||
|
||||
## Path parameters
|
||||
@@ -14,6 +15,10 @@ if any article still references it.
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | |
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `204`
|
||||
|
||||
Deleted
|
||||
|
||||
65
docs/api/routes/brand/update.md
Normal file
65
docs/api/routes/brand/update.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# `PATCH /brand/{id}`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Rename brand
|
||||
|
||||
Renames/updates a brand by id for the selected company. Fails with
|
||||
`Brand already exists` if the name is taken by another brand.
|
||||
When the name changes, linked articles (`brand_id`) get their
|
||||
`updated_at` bumped; the response reports `touchedArticleCount`.
|
||||
Emits SSE signal `brand` with payload `{ sender, brandId }`
|
||||
(`sender` echoes the caller's `x-client-id`).
|
||||
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `id` | yes | integer | |
|
||||
|
||||
## Body (JSON)
|
||||
|
||||
| Field | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `name` | no | string | |
|
||||
| `gsprpinfo` | no | string | |
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Acme GmbH"
|
||||
}
|
||||
```
|
||||
|
||||
## Signals
|
||||
|
||||
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
||||
|
||||
## Response `200`
|
||||
|
||||
Updated brand
|
||||
|
||||
```json
|
||||
{
|
||||
"brand": {
|
||||
"id": 1,
|
||||
"name": "…",
|
||||
"gsprpinfo": "…",
|
||||
"touchedArticleCount": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Invalid brand, invalid id, or no company selected — `{"error":"…"}` |
|
||||
| 401 | Unauthorized — `{"error":"…"}` |
|
||||
| 403 | Not authorized — `{"error":"…"}` |
|
||||
| 404 | Brand or company not found — `{"error":"…"}` |
|
||||
| 409 | Brand already exists — `{"error":"…"}` |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
@@ -29,6 +29,12 @@ to the company at connect time).
|
||||
| `category` | `POST /category`, `PATCH /category/{id}`, `PUT /category/order`, `DELETE /category/{id}`, `POST /category/{id}/image`, `DELETE /category/{id}/image` |
|
||||
| `articles` | `POST /article`, `PATCH /article/{sku}`, `DELETE /article/{sku}` |
|
||||
| `article-<sku>` | `PUT /article/{sku}/weight`, `PUT /article/{sku}/prices`, `PUT /article/{sku}/eans`, `PUT /article/{sku}/categories`, `PUT /article/{sku}/brand`, `PUT /article/{sku}/images/order`, `POST /article/{sku}/image`, `DELETE /article/{sku}/image/{fullHash}` |
|
||||
| `brand` | `POST /brand`, `PATCH /brand/{id}`, `DELETE /brand/{id}`, `POST /brand/{id}/image`, `DELETE /brand/{id}/image` |
|
||||
|
||||
The `brand` signal carries a JSON payload `{ sender, brandId }`:
|
||||
`sender` echoes the caller's `x-client-id` header (empty string if
|
||||
absent) so the sender can ignore its own event; `brandId` is the
|
||||
affected brand id (`null` only if unknown). Other signals send `{}`.
|
||||
|
||||
Signals are only sent when the mutation actually succeeds (2xx).
|
||||
Failed or no-op validation errors do not emit. The `article-<sku>`
|
||||
@@ -38,7 +44,8 @@ event name uses the concrete SKU (e.g. `article-42000045`).
|
||||
## Response `200`
|
||||
|
||||
SSE stream (`text/event-stream`). Each signal is an SSE event
|
||||
whose name is the signal id and whose data is `{}`.
|
||||
whose name is the signal id. Most signals send `{}` as data;
|
||||
`brand` sends `{ "sender": "<x-client-id>", "brandId": 12 }`.
|
||||
|
||||
|
||||
## Errors
|
||||
|
||||
Reference in New Issue
Block a user