u
This commit is contained in:
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`._
|
||||
Reference in New Issue
Block a user