This commit is contained in:
seb
2026-10-04 19:38:12 +02:00
parent 067ddc088c
commit c80bfee8e8
7 changed files with 59 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
*Source: `src/store/article/addChild.js`*
Adds a child article to a father article.
Adds a child article to a father article (creates and attaches with auto-generated SKU).
**Parameters**
@@ -15,6 +15,7 @@ Adds a child article to a father article.
| `googleAuthId` | `number` | The id of the Google auth user. |
| `fatherSku` | `string` | The father article SKU. |
| `options` | `object` | |
| `[options.attach=false]` | `boolean` | If true, attaches an existing article instead of creating. |
| `[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). |
@@ -53,6 +54,33 @@ const result = await store.article.addImage(42, 'SKU-1', imageBuffer);
// => { picId, sort, full: { w, h, size }, thumb: { w, h }, fullHash, thumbHash }
```
## `article.attachChild`
*Source: `src/store/article/attachChild.js`*
Attaches an existing article as a child 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.sku` | `string` | The child article SKU to attach. |
| `[options.childSku]` | `string` | Alias for options.sku. |
| `[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.reparent=false]` | `boolean` | Whether to allow re-parenting if child belongs to another father. |
| `[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<{article: object, children: Array<object>}>`
## `article.createUnderParent`
*Source: `src/store/article/createUnderParent.js`*