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:
seb
2026-08-11 05:36:07 +02:00
parent fb88cb92a5
commit af416246b4
8 changed files with 655 additions and 0 deletions

View File

@@ -29,6 +29,9 @@ import articleSetEansBySku from './store/article/setEansBySku.js';
import articleSetBrandIdBySku from './store/article/setBrandIdBySku.js';
import articleSetWeightBySku from './store/article/setWeightBySku.js';
import articleSetCategoryIdsBySku from './store/article/setCategoryIdsBySku.js';
import articleSetFatherBySku from './store/article/setFatherBySku.js';
import articleImportRows from './store/article/importRows.js';
import categoryEnsureByPath from './store/category/ensureByPath.js';
import unitList from './store/unit/list.js';
import unitUpsert from './store/unit/upsert.js';
import unitDelete from './store/unit/delete.js';
@@ -129,6 +132,7 @@ export default class LibDashStore {
getTreeForCompany: categoryGetTreeForCompany(pool),
getCategoryArticles: categoryGetCategoryArticles(pool),
createUnderParent: categoryCreateUnderParent(pool),
ensureByPath: categoryEnsureByPath(pool),
rename: categoryRename(pool),
move: categoryMove(pool),
order: categoryOrder(pool),
@@ -149,6 +153,8 @@ export default class LibDashStore {
setBrandIdBySku: articleSetBrandIdBySku(pool),
setWeightBySku: articleSetWeightBySku(pool),
setCategoryIdsBySku: articleSetCategoryIdsBySku(pool),
setFatherBySku: articleSetFatherBySku(pool),
importRows: articleImportRows(pool),
addImage: articleAddImage(pool),
deleteImage: articleDeleteImage(pool),
orderImages: articleOrderImages(pool),