This commit is contained in:
seb
2026-09-29 18:26:42 +02:00
parent 30820ba8c7
commit 69bd0935cc
14 changed files with 710 additions and 20 deletions

View File

@@ -2,6 +2,31 @@
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `article.addChild`
*Source: `src/store/article/addChild.js`*
Adds a child article to a father article.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fatherSku` | `string` | The father article SKU. |
| `options` | `object` | |
| `[options.attributeValueId]` | `number` | Existing attribute value ID for father's attribute. |
| `[options.value]` | `string` | String value to find or create under father's attribute. |
| `[options.name]` | `string` | Custom name for child article (defaults to father name + value). |
| `[options.unitamount]` | `number` | Optional unitamount override. |
| `[options.weight]` | `number` | Optional weight override. |
| `[options.track_stock]` | `boolean|number` | Optional track_stock override. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object>` — The created child article detail.
## `article.addImage`
*Source: `src/store/article/addImage.js`*
@@ -211,6 +236,24 @@ const result = await store.article.importRows({
// => { imported: [...], skipped: [...], errors: [...] }
```
## `article.listChildren`
*Source: `src/store/article/listChildren.js`*
Lists all children of a father article.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fatherSku` | `string` | The father article SKU. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<Array<{id: number, sku: string, fathersort: number, trackStock: boolean, unitamount: number, weight: number, name: string|null, slug: string|null, attributeValueId: number|null, attributeValue: string|null}>>`
## `article.listExport`
*Source: `src/store/article/listExport.js`*
@@ -295,6 +338,27 @@ const result = await store.article.orderImages(42, 'SKU-1', { fullHashes: ['a',
// => { fullHashes: ['a', 'b'] }
```
## `article.removeChild`
*Source: `src/store/article/removeChild.js`*
Removes a child article from a father article, either by unlinking or deleting it.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fatherSku` | `string` | The father article SKU. |
| `childSku` | `string` | The child article SKU. |
| `[options]` | `object` | |
| `[options.deleteArticle=false]` | `boolean` | Whether to delete the child article entity entirely. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<{success: boolean, fatherSku: string, childSku: string, deleted: boolean}>`
## `article.setBrandIdBySku`
*Source: `src/store/article/setBrandIdBySku.js`*
@@ -505,6 +569,28 @@ const article = await store.article.setWeightBySku(42, 'SKU-1', 1.5);
// => { id, sku, name, ... }
```
## `article.toggleFather`
*Source: `src/store/article/toggleFather.js`*
Toggles an article into or out of father mode.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `sku` | `string` | The article SKU. |
| `options` | `object` | |
| `options.isFather` | `boolean` | Whether the article should be a father article. |
| `[options.attributeNameId]` | `number` | The attribute name id required when enabling father mode. |
| `[options.fatherAttributeNameId]` | `number` | Alias for attributeNameId. |
| `[tx]` | `object` | Optional transaction. |
**Returns**
`Promise<object>` — The updated article detail.
## `article.updateBySku`
*Source: `src/store/article/updateBySku.js`*