u
This commit is contained in:
@@ -6,19 +6,19 @@ 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 (creates and attaches with auto-generated SKU).
|
||||
Adds a child article to a parent article (creates and attaches with auto-generated SKU).
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `fatherSku` | `string` | The father article SKU. |
|
||||
| `parentSku` | `string` | The parent 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). |
|
||||
| `[options.attributeValueId]` | `number` | Existing attribute value ID for parent's attribute. |
|
||||
| `[options.value]` | `string` | String value to find or create under parent's attribute. |
|
||||
| `[options.name]` | `string` | Custom name for child article (defaults to parent name + value). |
|
||||
| `[options.unitamount]` | `number` | Optional unitamount override. |
|
||||
| `[options.weight]` | `number` | Optional weight override. |
|
||||
| `[options.track_stock]` | `boolean|number` | Optional track_stock override. |
|
||||
@@ -58,20 +58,20 @@ const result = await store.article.addImage(42, 'SKU-1', imageBuffer);
|
||||
|
||||
*Source: `src/store/article/attachChild.js`*
|
||||
|
||||
Attaches an existing article as a child to a father article.
|
||||
Attaches an existing article as a child to a parent article.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `fatherSku` | `string` | The father article SKU. |
|
||||
| `parentSku` | `string` | The parent 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.attributeValueId]` | `number` | Existing attribute value ID for parent's attribute. |
|
||||
| `[options.value]` | `string` | String value to find or create under parent's attribute. |
|
||||
| `[options.reparent=false]` | `boolean` | Whether to allow re-parenting if child belongs to another parent. |
|
||||
| `[options.unitamount]` | `number` | Optional unitamount override. |
|
||||
| `[options.weight]` | `number` | Optional weight override. |
|
||||
| `[options.track_stock]` | `boolean|number` | Optional track_stock override. |
|
||||
@@ -184,7 +184,7 @@ Returns the full detail of an article by its SKU, including unit, brand, categor
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, track_stock: boolean, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {id: number|null, name: string, fullHash: string|null, thumbW: number|null, thumbH: number|null, thumbHash: string|null}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>` — The full article detail.
|
||||
`Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, track_stock: boolean, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {id: number|null, name: string, fullHash: string|null, thumbW: number|null, thumbH: number|null, thumbHash: string|null}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, parentArticleId: number|null, parentSku: string|null}}>` — The full article detail.
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -231,7 +231,7 @@ const recent = await store.article.getHistoryBySku(42, 'SKU-1', { limit: 5 });
|
||||
|
||||
*Source: `src/store/article/importRows.js`*
|
||||
|
||||
Imports article rows, creating articles by their SKU and returning per-row import, skip and error outcomes. The import runs in **two passes** so a `fatherSku` that references a row appearing later in the file still resolves. A row is **skipped** when its SKU already exists in the company (upsert mode is not applied), and an EAN is skipped when already used by another row.
|
||||
Imports article rows, creating articles by their SKU and returning per-row import, skip and error outcomes. The import runs in **two passes** so a `parentSku` that references a row appearing later in the file still resolves. A row is **skipped** when its SKU already exists in the company (upsert mode is not applied), and an EAN is skipped when already used by another row.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -242,7 +242,7 @@ Imports article rows, creating articles by their SKU and returning per-row impor
|
||||
| `input.rows` | `Array<object>` | The article rows to import. |
|
||||
| `input.rows[].sku` | `string` | The article SKU. |
|
||||
| `input.rows[].name` | `string` | The article name. |
|
||||
| `[input.rows[].vk]` | `string` | `'V'` (father/compound) or `'K'` (variant) marker. |
|
||||
| `[input.rows[].vk]` | `string` | `'V'` (parent/compound) or `'K'` (variant) marker. |
|
||||
| `[input.rows[].parentId]` | `number|string` | The id of the parent category. |
|
||||
| `[input.rows[].parentCategory]` | `string` | The category breadcrumb path, e.g. `'Flowers | CBN'`. |
|
||||
| `[input.rows[].brand]` | `string` | The brand name to upsert. |
|
||||
@@ -250,7 +250,7 @@ Imports article rows, creating articles by their SKU and returning per-row impor
|
||||
| `[input.rows[].tax]` | `number|string` | The tax rate in percent (e.g. `19`). |
|
||||
| `[input.rows[].eans]` | `Array<string>|string` | The EANs to set. |
|
||||
| `[input.rows[].track_stock=true]` | `boolean|number` | Whether inventory stock is tracked. |
|
||||
| `[input.rows[].fatherSku]` | `string` | The father article SKU for a V/K compound link. |
|
||||
| `[input.rows[].parentSku]` | `string` | The parent article SKU for a V/K compound link. |
|
||||
| `[input.rows[].deposit]` | `number|string` | The deposit (Pfand) value; currently ignored. |
|
||||
| `[tx]` | `object` | Optional transaction. |
|
||||
|
||||
@@ -264,7 +264,7 @@ Imports article rows, creating articles by their SKU and returning per-row impor
|
||||
const result = await store.article.importRows({
|
||||
googleAuthId: 42,
|
||||
rows: [
|
||||
{ sku: '42001190-1', name: '420Strainz 1g', vk: 'K', parentCategory: 'Flowers | CBN', brand: 'Seedstockers', net: '11,00', tax: 19, eans: ['4262557690455'], fatherSku: '42001190' },
|
||||
{ sku: '42001190-1', name: '420Strainz 1g', vk: 'K', parentCategory: 'Flowers | CBN', brand: 'Seedstockers', net: '11,00', tax: 19, eans: ['4262557690455'], parentSku: '42001190' },
|
||||
{ sku: '42001190', name: '420Strainz', vk: 'V', parentCategory: 'Flowers | CBN', brand: 'Seedstockers', net: '0,00', tax: 19 },
|
||||
],
|
||||
});
|
||||
@@ -275,19 +275,19 @@ const result = await store.article.importRows({
|
||||
|
||||
*Source: `src/store/article/listChildren.js`*
|
||||
|
||||
Lists all children of a father article.
|
||||
Lists all children of a parent article.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `fatherSku` | `string` | The father article SKU. |
|
||||
| `parentSku` | `string` | The parent 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}>>`
|
||||
`Promise<Array<{id: number, sku: string, parentsort: number, trackStock: boolean, unitamount: number, weight: number, name: string|null, slug: string|null, attributeValueId: number|null, attributeValue: string|null}>>`
|
||||
|
||||
## `article.listExport`
|
||||
|
||||
@@ -377,14 +377,14 @@ const result = await store.article.orderImages(42, 'SKU-1', { fullHashes: ['a',
|
||||
|
||||
*Source: `src/store/article/removeChild.js`*
|
||||
|
||||
Removes a child article from a father article, either by unlinking or deleting it.
|
||||
Removes a child article from a parent 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. |
|
||||
| `parentSku` | `string` | The parent article SKU. |
|
||||
| `childSku` | `string` | The child article SKU. |
|
||||
| `[options]` | `object` | |
|
||||
| `[options.deleteArticle=false]` | `boolean` | Whether to delete the child article entity entirely. |
|
||||
@@ -393,7 +393,7 @@ Removes a child article from a father article, either by unlinking or deleting i
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{success: boolean, fatherSku: string, childSku: string, deleted: boolean}>`
|
||||
`Promise<{success: boolean, parentSku: string, childSku: string, deleted: boolean}>`
|
||||
|
||||
## `article.resolveUniqueSlug`
|
||||
|
||||
@@ -506,11 +506,11 @@ const article = await store.article.setEansBySku(42, 'SKU-1', ['4001234567890'])
|
||||
// => { id, sku, name, ... }
|
||||
```
|
||||
|
||||
## `article.setFatherBySku`
|
||||
## `article.setParentBySku`
|
||||
|
||||
*Source: `src/store/article/setFatherBySku.js`*
|
||||
*Source: `src/store/article/setParentBySku.js`*
|
||||
|
||||
Links an article to a father article (V/K compound) by their SKUs.
|
||||
Links an article to a parent article (V/K compound) by their SKUs.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -518,7 +518,7 @@ Links an article to a father article (V/K compound) by their SKUs.
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `sku` | `string` | The child article SKU. |
|
||||
| `fatherSku` | `string|null` | The father article SKU, or `null` to unlink. |
|
||||
| `parentSku` | `string|null` | The parent article SKU, or `null` to unlink. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
@@ -527,13 +527,13 @@ Links an article to a father article (V/K compound) by their SKUs.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the article or father is not found, or the link is invalid.
|
||||
`Error` — If the article or parent is not found, or the link is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const article = await store.article.setFatherBySku(42, '42001190-1', '42001190');
|
||||
// => { id, sku, name, fatherSku: '42001190', ... }
|
||||
const article = await store.article.setParentBySku(42, '42001190-1', '42001190');
|
||||
// => { id, sku, name, parentSku: '42001190', ... }
|
||||
```
|
||||
|
||||
## `article.setPricesBySku`
|
||||
@@ -626,11 +626,11 @@ const article = await store.article.setWeightBySku(42, 'SKU-1', 1.5);
|
||||
// => { id, sku, name, ... }
|
||||
```
|
||||
|
||||
## `article.toggleFather`
|
||||
## `article.toggleParent`
|
||||
|
||||
*Source: `src/store/article/toggleFather.js`*
|
||||
*Source: `src/store/article/toggleParent.js`*
|
||||
|
||||
Toggles an article into or out of father mode.
|
||||
Toggles an article into or out of parent mode.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -639,9 +639,9 @@ Toggles an article into or out of father mode.
|
||||
| `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. |
|
||||
| `options.isParent` | `boolean` | Whether the article should be a parent article. |
|
||||
| `[options.attributeNameId]` | `number` | The attribute name id required when enabling parent mode. |
|
||||
| `[options.parentAttributeNameId]` | `number` | Alias for attributeNameId. |
|
||||
| `[tx]` | `object` | Optional transaction. |
|
||||
|
||||
**Returns**
|
||||
|
||||
Reference in New Issue
Block a user