feat(article): add article import with V/K compound linking
Add article.importRows to create articles by SKU from CSV-style rows, running in two passes so fatherSku links to rows later in the file still resolve. Existing SKUs are skipped, duplicate EANs are dropped, prices and taxes are ensured, brands are upserted by name, and parent categories are resolved/created via breadcrumb path. Also add: - article.setFatherBySku to link/unlink a child to its father article - category.ensureByPath to resolve or create categories by path (tx-aware) - supporting SQL constants (GET_ID_BY_SKU, EAN_EXISTS, father-link helpers, GET_BY_PARENT_AND_NAME) - regenerated API docs
This commit is contained in:
@@ -109,6 +109,33 @@ const result = await store.category.deleteImage(42, 5);
|
||||
// => { id: 5, thumbW: null, thumbH: null, thumbHash: null }
|
||||
```
|
||||
|
||||
## `category.ensureByPath`
|
||||
|
||||
*Source: `src/store/category/ensureByPath.js`*
|
||||
|
||||
Resolves a category by breadcrumb path under a given parent, creating any missing categories along the way. Returns the leaf category id.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `input` | `object` | The category resolution input. |
|
||||
| `input.googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input.parentId` | `number` | The id of the parent category to start from. |
|
||||
| `input.path` | `string` | The breadcrumb path, e.g. `'Haupt | Flowers | CBN'`. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<number>` — The id of the leaf category.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const id = await store.category.ensureByPath({ googleAuthId: 42, parentId: 5, path: 'Haupt | Flowers | CBN' });
|
||||
// => 12
|
||||
```
|
||||
|
||||
## `category.getCategoryArticles`
|
||||
|
||||
*Source: `src/store/category/getCategoryArticles.js`*
|
||||
|
||||
Reference in New Issue
Block a user