This commit is contained in:
seb
2026-10-11 03:30:26 +02:00
parent cf1c8d1126
commit 7ffb21aabb
5 changed files with 72 additions and 5 deletions

View File

@@ -48,11 +48,11 @@ export default function list(provider) {
* @param {number} [opts.limit=10] - Number of brands to return (max 100).
* @param {boolean} [opts.includeSmallThumbs=false] - Include 32px-edge small thumbnail dimensions and base64 AVIF data.
* @param {object} [tx] - Optional transaction to run within.
* @returns {Promise<{brands: Array<{id: number, name: string, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW?: number|null, smallThumbH?: number|null, smallThumbBinary?: string|null}>}>, total: number, offset: number, limit: number}>} The brands plus the total unpaged count. Small-thumbnail fields are present only when `includeSmallThumbs` is true; the binary is base64-encoded AVIF data.
* @returns {Promise<{brands: Array<{id: number, name: string, articleCount: number, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW?: number|null, smallThumbH?: number|null, smallThumbBinary?: string|null}>}>, total: number, offset: number, limit: number}>} The brands plus the total unpaged count. Small-thumbnail fields are present only when `includeSmallThumbs` is true; the binary is base64-encoded AVIF data.
*
* @example
* const result = await store.brand.list(42, { offset: 0, limit: 10 });
* // => { brands: [{ id, name, gsprpinfo, pics: [...] }], total: 25, offset: 0, limit: 10 }
* // => { brands: [{ id, name, articleCount, gsprpinfo, pics: [...] }], total: 25, offset: 0, limit: 10 }
*/
return async (googleAuthId, opts, tx) => {
let offset = 0;
@@ -91,6 +91,7 @@ export default function list(provider) {
brands: listResult.rows.map((row) => ({
id: row.id,
name: row.name,
articleCount: Number(row.articleCount ?? 0),
gsprpinfo: row.gsprpinfo,
pics: parsePics(row.picsJson),
})),