This commit is contained in:
seb
2026-10-04 21:22:05 +02:00
parent 0268583ae3
commit 4718cb5726
48 changed files with 758 additions and 758 deletions

View File

@@ -52,7 +52,7 @@ export async function fillDatabase(store, options = {}) {
secondaryCompany: null,
categories: [],
articles: [],
fatherArticles: [],
parentArticles: [],
childArticles: [],
customergroups: [],
entities: [],
@@ -326,7 +326,7 @@ export async function fillDatabase(store, options = {}) {
const numArticles = counts.articles;
for (let i = 1; i <= numArticles; i++) {
const targetCat = ctx.categories[i % ctx.categories.length];
const isFather = i % 4 === 1;
const isParent = i % 4 === 1;
const art = await store.article.createUnderParent({
googleAuthId: ctx.googleAuthId,
parentId: targetCat.id,
@@ -365,12 +365,12 @@ export async function fillDatabase(store, options = {}) {
ctx.categories[(i + 1) % ctx.categories.length].id,
]);
// V/K Father-Child hierarchy
if (isFather) {
ctx.fatherArticles.push(art);
} else if (ctx.fatherArticles.length > 0) {
const parentFather = ctx.fatherArticles[ctx.fatherArticles.length - 1];
await store.article.setFatherBySku(ctx.googleAuthId, sku, parentFather.sku);
// V/K Parent-Child hierarchy
if (isParent) {
ctx.parentArticles.push(art);
} else if (ctx.parentArticles.length > 0) {
const parentParent = ctx.parentArticles[ctx.parentArticles.length - 1];
await store.article.setParentBySku(ctx.googleAuthId, sku, parentParent.sku);
ctx.childArticles.push(art);
}
@@ -426,7 +426,7 @@ export async function fillDatabase(store, options = {}) {
brand: 'BenchBrand Pro',
net: '45,50',
tax: 19,
fatherSku: `IMP-${Date.now()}-1`,
parentSku: `IMP-${Date.now()}-1`,
},
];
await store.article.importRows({