This commit is contained in:
seb
2026-09-22 08:31:01 +02:00
parent cca131d83a
commit dce65db435
11 changed files with 1453 additions and 30 deletions

View File

@@ -53,25 +53,19 @@ export default function setFatherBySku(provider) {
throw new Error('Invalid father');
}
await runner.query(queries.UPDATE_FATHER_BY_SKU, {
sku,
fatherArticleId: fatherId,
});
await runner.query(queries.SET_IS_FATHER, {
articleId: fatherId,
});
const childCount = await runner.query(getChildCountSql, {
articleId: fatherId,
});
const count = childCount.rows[0].count;
// The child's sort is its 0-based position among the father's children.
await runner.query(queries.SET_FATHER_SORT, {
articleId,
await runner.query(queries.UPDATE_FATHER_BY_SKU, {
sku,
fatherArticleId: fatherId,
fathersort: count - 1,
fathersort: count,
});
await runner.query(queries.SET_IS_FATHER, {
articleId: fatherId,
});
const article = await load(articleId, languageId, runner);