u
This commit is contained in:
@@ -142,6 +142,37 @@ const id = await store.category.ensureByPath({ googleAuthId: 42, parentId: 5, pa
|
||||
// => 12
|
||||
```
|
||||
|
||||
## `category.generateImage`
|
||||
|
||||
*Source: `src/store/category/generateImage.js`*
|
||||
|
||||
Generates a mosaic image directly from the category's and its subcategories' articles (grouped by subcategory) and sets it as the new main picture for the category.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `inputOrCategoryId` | `number|object` | The id of the category or an options object. |
|
||||
| `[maybeOptsOrSize={}]` | `object|number` | Options object or numeric size. |
|
||||
| `[maybeOptsOrSize.size]` | `number` | Grid size (2 for 2x2, 3 for 3x3, 4 for 4x4). Defaults to 3 (falls back to 2 if < 7 images). |
|
||||
| `[maybeTx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, fullHash: string, thumbW: number, thumbH: number, thumbHash: string, smallThumbW: number, smallThumbH: number, size: number, grid: string, articleCount: number}>` — The new main image info.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the category is not found, not authorized, size is invalid, or no images are found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const result = await store.category.generateImage(42, 5, { size: 3 });
|
||||
// => { id: 5, fullHash, thumbW, thumbH, thumbHash, smallThumbW, smallThumbH, size: 3, grid: '3x3', articleCount: 12 }
|
||||
```
|
||||
|
||||
## `category.getCategoryArticles`
|
||||
|
||||
*Source: `src/store/category/getCategoryArticles.js`*
|
||||
|
||||
Reference in New Issue
Block a user