This commit is contained in:
seb
2026-10-09 18:10:51 +02:00
parent 4ae3439289
commit 07c4f0bff9
8 changed files with 130 additions and 43 deletions

View File

@@ -39,7 +39,7 @@ Creates a brand for the user's selected company.
**Returns**
`Promise<{id: number, name: string, gsprpinfo: string|null, pics: Array<{id: number, sort: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>` — The created brand.
`Promise<{id: number, name: string, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>` — The created brand.
**Throws**
@@ -84,24 +84,27 @@ await store.brand.delete(42, 3);
*Source: `src/store/brand/list.js`*
Lists the brands of the user's selected company.
Lists the brands of the user's selected company, sorted by name.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[opts]` | `object` | Optional pagination options. |
| `[opts.offset=0]` | `number` | Number of brands to skip. |
| `[opts.limit=10]` | `number` | Number of brands to return (max 100). |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<Array<{id: number, name: string, gsprpinfo: string|null, pics: Array<{id: number, sort: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>>` — The brands.
`Promise<{brands: Array<{id: number, name: string, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>, total: number, offset: number, limit: number}>` — The brands plus the total unpaged count.
**Example**
```js
const brands = await store.brand.list(42);
// => [{ id, name, gsprpinfo, pics: [{ sort, fullHash, thumbW, thumbH, thumbHash }] }]
const result = await store.brand.list(42, { offset: 0, limit: 10 });
// => { brands: [{ id, name, gsprpinfo, pics: [...] }], total: 25, offset: 0, limit: 10 }
```
## `brand.update`
@@ -154,7 +157,7 @@ Creates or updates a brand for the user's selected company, keyed by name.
**Returns**
`Promise<{id: number, name: string, gsprpinfo: string|null, pics: Array<{id: number, sort: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>` — The upserted brand.
`Promise<{id: number, name: string, gsprpinfo: string|null, pics: Array<{fullHash: string, thumbW: number, thumbH: number, thumbHash: string}>}>` — The upserted brand.
**Throws**