This commit is contained in:
seb
2026-10-06 04:43:35 +02:00
parent 75ab6ce171
commit fe5990af9f
8 changed files with 571 additions and 104 deletions

View File

@@ -0,0 +1,51 @@
# `DELETE /brand/{id}/image`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Delete brand image
Removes the brand's image. Sets thumbW, thumbH, thumbHash back to null.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Brand id |
## Response `200`
Image removed
```json
{
"brand": {
"id": 1,
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…",
"pics": [
{
"id": 1,
"sort": 1,
"fullHash": "…",
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | No company selected or invalid id — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Brand or image not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._

View File

@@ -0,0 +1,62 @@
# `POST /brand/{id}/image`
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.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Brand id |
## Body
Raw binary (`image/avif`).
Raw binary (`image/webp`).
Raw binary (`application/octet-stream`).
## Response `201`
Image stored and linked
```json
{
"brand": {
"id": 1,
"fullHash": "…",
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…",
"pics": [
{
"id": 1,
"sort": 1,
"fullHash": "…",
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing body or invalid image — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Brand not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._