From b5e7643e12faee69903f9d7f16b3f20629bec481 Mon Sep 17 00:00:00 2001 From: seb Date: Sun, 11 Oct 2026 03:30:30 +0200 Subject: [PATCH] u --- docs/api/routes-all.md | 2 +- docs/api/routes.md | 2 +- docs/api/routes/brand/list.md | 3 ++- src/api/openapi.js | 5 ++++- src/api/routes/brand.js | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/api/routes-all.md b/docs/api/routes-all.md index d121f31..634f352 100644 --- a/docs/api/routes-all.md +++ b/docs/api/routes-all.md @@ -233,7 +233,7 @@ _none_ #### List brands — `GET /brand` - Params: `query: offset?: int, limit?: int, includeSmallThumbs?: bool` -- Returns: `200 { brands: { id: int, name: str, pics: { fullHash: str, thumbW: int, thumbH: int, thumbHash: str, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null }[], gsprpinfo?: str|null }[], total: int, offset: int, limit: int }` +- Returns: `200 { brands: { id: int, name: str, articleCount: int, pics: { fullHash: str, thumbW: int, thumbH: int, thumbHash: str, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null }[], gsprpinfo?: str|null }[], total: int, offset: int, limit: int }` #### Create brand — `POST /brand` - Params: `body: { name: str, gsprpinfo?: str }` - Returns: `201 { brand: { id: int, name: str, pics: T36[], gsprpinfo?: str|null } }` diff --git a/docs/api/routes.md b/docs/api/routes.md index b84383b..3f1cbdd 100644 --- a/docs/api/routes.md +++ b/docs/api/routes.md @@ -216,7 +216,7 @@ _none_ #### List brands — `GET /brand` - Params: `query: offset?: int, limit?: int, includeSmallThumbs?: bool` -- Returns: `200 { brands: { id: int, name: str, pics: { fullHash: str, thumbW: int, thumbH: int, thumbHash: str, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null }[], gsprpinfo?: str|null }[], total: int, offset: int, limit: int }` +- Returns: `200 { brands: { id: int, name: str, articleCount: int, pics: { fullHash: str, thumbW: int, thumbH: int, thumbHash: str, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null }[], gsprpinfo?: str|null }[], total: int, offset: int, limit: int }` #### Create brand — `POST /brand` - Params: `body: { name: str, gsprpinfo?: str }` - Returns: `201 { brand: { id: int, name: str, pics: T32[], gsprpinfo?: str|null } }` diff --git a/docs/api/routes/brand/list.md b/docs/api/routes/brand/list.md index 05f8381..c39c195 100644 --- a/docs/api/routes/brand/list.md +++ b/docs/api/routes/brand/list.md @@ -4,7 +4,7 @@ Protected. Requires a valid session cookie (`credentials: 'include'`). List brands -Lists brands for the authenticated user's selected company, sorted by name. Paged; `total` is the unpaged count. Small-thumbnail fields are omitted by default. Set `includeSmallThumbs=true` to include each picture's `smallThumbW`, `smallThumbH`, and `smallThumbBinary` (base64-encoded AVIF bytes, resized with a 32px maximum edge). +Lists brands for the authenticated user's selected company, sorted by name. Paged; `total` is the unpaged count. Each brand includes `articleCount` (child articles inherit the brand from their father article; father articles are not counted). Small-thumbnail fields are omitted by default. Set `includeSmallThumbs=true` to include each picture's `smallThumbW`, `smallThumbH`, and `smallThumbBinary` (base64-encoded AVIF bytes, resized with a 32px maximum edge). ## Query parameters @@ -24,6 +24,7 @@ Brand list { "id": 1, "name": "…", + "articleCount": 1, "gsprpinfo": "…", "pics": [ { diff --git a/src/api/openapi.js b/src/api/openapi.js index 6ce7550..c390ade 100644 --- a/src/api/openapi.js +++ b/src/api/openapi.js @@ -396,12 +396,15 @@ * description: Base64-encoded small AVIF thumbnail bytes * BrandList: * type: object - * required: [id, name, pics] + * required: [id, name, articleCount, pics] * properties: * id: * type: integer * name: * type: string + * articleCount: + * type: integer + * description: Number of articles assigned to this brand (excluding father articles, including child articles inheriting the brand) * gsprpinfo: * type: string * nullable: true diff --git a/src/api/routes/brand.js b/src/api/routes/brand.js index c80a467..a413db5 100644 --- a/src/api/routes/brand.js +++ b/src/api/routes/brand.js @@ -51,7 +51,7 @@ export function register(app, basePath = '') { * get: * tags: [Brand] * summary: List brands - * description: Lists brands for the authenticated user's selected company, sorted by name. Paged; `total` is the unpaged count. Small-thumbnail fields are omitted by default. Set `includeSmallThumbs=true` to include each picture's `smallThumbW`, `smallThumbH`, and `smallThumbBinary` (base64-encoded AVIF bytes, resized with a 32px maximum edge). + * description: Lists brands for the authenticated user's selected company, sorted by name. Paged; `total` is the unpaged count. Each brand includes `articleCount` (child articles inherit the brand from their father article; father articles are not counted). Small-thumbnail fields are omitted by default. Set `includeSmallThumbs=true` to include each picture's `smallThumbW`, `smallThumbH`, and `smallThumbBinary` (base64-encoded AVIF bytes, resized with a 32px maximum edge). * security: * - cookieAuth: [] * parameters: