diff --git a/docs/api/routes-all.md b/docs/api/routes-all.md index e6fa21a..f59dec9 100644 --- a/docs/api/routes-all.md +++ b/docs/api/routes-all.md @@ -320,7 +320,7 @@ _none_ - Returns: `200 { category: { id: int, name: str, slug: str, parentId: int, sort: int } }` #### Articles in category — `GET /category/{id}/articles` - Params: `id: int` -- Returns: `200 { articles: { id: int, sku: str, name: str, slug: str, track_stock: bool, optionsCount: int, articleListCount: int, childCount: int, net?: num|null, taxRate?: num|null, parentArticleId?: int|null, parentSku?: str|null, fullHash?: str|null, thumbW?: int|null, thumbH?: int|null, thumbHash?: str|null, brand?: T26|null, articlewarehousesummary?: { id: int, articleId: int, warehouseId: int, stock: num, article_id?: int, warehouse_id?: int, warehouseName?: str|null }[], warehouses?: { id: int, name: str, stock: num }[] }[] }` +- Returns: `200 { articles: { id: int, sku: str, name: str, slug: str, track_stock: bool, optionsCount: int, articleListCount: int, childCount: int, net?: num|null, taxRate?: num|null, parentArticleId?: int|null, parentSku?: str|null, fullHash?: str|null, thumbW?: int|null, thumbH?: int|null, thumbHash?: str|null, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null, brand?: T26|null, articlewarehousesummary?: { id: int, articleId: int, warehouseId: int, stock: num, article_id?: int, warehouse_id?: int, warehouseName?: str|null }[], warehouses?: { id: int, name: str, stock: num }[] }[] }` #### List category attribute values — `GET /category/{id}/attributevalue` - Params: `id: int` - Returns: `200 { attributevalues: { id: int, attributeId: int, attributeName: str, attributeValueId: int, value: str, sort: int, categoryId?: int, exclusive?: bool }[] }` diff --git a/docs/api/routes.md b/docs/api/routes.md index 37736e3..a5b21b7 100644 --- a/docs/api/routes.md +++ b/docs/api/routes.md @@ -248,7 +248,7 @@ _none_ - Returns: `200 { category: { id: int, name: str, slug: str, parentId: int, sort: int } }` #### Articles in category — `GET /category/{id}/articles` - Params: `id: int` -- Returns: `200 { articles: { id: int, sku: str, name: str, slug: str, track_stock: bool, optionsCount: int, articleListCount: int, childCount: int, net?: num|null, taxRate?: num|null, parentArticleId?: int|null, parentSku?: str|null, fullHash?: str|null, thumbW?: int|null, thumbH?: int|null, thumbHash?: str|null, brand?: T20|null, articlewarehousesummary?: { id: int, articleId: int, warehouseId: int, stock: num, article_id?: int, warehouse_id?: int, warehouseName?: str|null }[], warehouses?: { id: int, name: str, stock: num }[] }[] }` +- Returns: `200 { articles: { id: int, sku: str, name: str, slug: str, track_stock: bool, optionsCount: int, articleListCount: int, childCount: int, net?: num|null, taxRate?: num|null, parentArticleId?: int|null, parentSku?: str|null, fullHash?: str|null, thumbW?: int|null, thumbH?: int|null, thumbHash?: str|null, smallThumbW?: int|null, smallThumbH?: int|null, smallThumbBinary?: str|null, brand?: T20|null, articlewarehousesummary?: { id: int, articleId: int, warehouseId: int, stock: num, article_id?: int, warehouse_id?: int, warehouseName?: str|null }[], warehouses?: { id: int, name: str, stock: num }[] }[] }` #### List category attribute values — `GET /category/{id}/attributevalue` - Params: `id: int` - Returns: `200 { attributevalues: { id: int, attributeId: int, attributeName: str, attributeValueId: int, value: str, sort: int, categoryId?: int, exclusive?: bool }[] }` diff --git a/docs/api/routes/category/articles.md b/docs/api/routes/category/articles.md index e51271e..d2942bd 100644 --- a/docs/api/routes/category/articles.md +++ b/docs/api/routes/category/articles.md @@ -4,7 +4,7 @@ Protected. Requires a valid session cookie (`credentials: 'include'`). Articles in category -Returns articles in a category the user is authorized for (omits child articles of a parent article), sorted alphabetically by name. Each article includes `childCount` (the number of its child articles). +Returns articles in a category the user is authorized for (omits child articles of a parent article), sorted alphabetically by name. Each article includes `childCount` (the number of its child articles) and small thumbnail fields (`smallThumbW`, `smallThumbH`, `smallThumbBinary`). ## Path parameters @@ -36,6 +36,9 @@ Articles list "thumbW": 1, "thumbH": 1, "thumbHash": "…", + "smallThumbW": 1, + "smallThumbH": 1, + "smallThumbBinary": "…", "brand": { "id": 1, "name": "…", diff --git a/src/api/openapi.js b/src/api/openapi.js index 0bcfda3..d8059aa 100644 --- a/src/api/openapi.js +++ b/src/api/openapi.js @@ -613,6 +613,19 @@ * thumbHash: * type: string * nullable: true + * smallThumbW: + * type: integer + * nullable: true + * description: Width in pixels of the small AVIF thumbnail + * smallThumbH: + * type: integer + * nullable: true + * description: Height in pixels of the small AVIF thumbnail + * smallThumbBinary: + * type: string + * format: byte + * nullable: true + * description: Base64-encoded small AVIF thumbnail bytes * brand: * $ref: '#/components/schemas/ArticleBrand' * nullable: true diff --git a/src/api/routes/category.js b/src/api/routes/category.js index 93a43dd..bbb9ba6 100644 --- a/src/api/routes/category.js +++ b/src/api/routes/category.js @@ -324,7 +324,7 @@ export function register(app, basePath = '') { * get: * tags: [Category] * summary: Articles in category - * description: Returns articles in a category the user is authorized for (omits child articles of a parent article), sorted alphabetically by name. Each article includes `childCount` (the number of its child articles). + * description: Returns articles in a category the user is authorized for (omits child articles of a parent article), sorted alphabetically by name. Each article includes `childCount` (the number of its child articles) and small thumbnail fields (`smallThumbW`, `smallThumbH`, `smallThumbBinary`). * security: * - cookieAuth: [] * x-markdown: category/articles.md @@ -382,6 +382,9 @@ export function register(app, basePath = '') { ...a, childCount: Number(a.childCount ?? 0), isParent: Boolean(a.isParent ?? a.is_parent), + smallThumbW: a.smallThumbW ?? null, + smallThumbH: a.smallThumbH ?? null, + smallThumbBinary: a.smallThumbBinary ?? null, })) .sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '') || a.id - b.id); res.status(200).json({ articles });