This commit is contained in:
seb
2026-09-25 12:30:45 +02:00
parent b5255bdd17
commit 607e6cc0ac
10 changed files with 98 additions and 124 deletions

View File

@@ -30,11 +30,12 @@ export default function setFatherBySku(provider) {
*/
return async (googleAuthId, sku, fatherSku, tx) => {
const runSet = async (runner) => {
const { articleId, languageId } = await resolve(googleAuthId, sku, runner);
const { articleId, languageId, companyId } = await resolve(googleAuthId, sku, runner);
if (fatherSku == null || fatherSku === '') {
await runner.query(queries.UPDATE_FATHER_BY_SKU, {
sku,
companyId,
fatherArticleId: null,
});
const unlinked = await load(articleId, languageId, runner);
@@ -44,7 +45,7 @@ export default function setFatherBySku(provider) {
return unlinked;
}
const father = await runner.query(queries.GET_ID_BY_SKU, { sku: fatherSku });
const father = await runner.query(queries.GET_ID_BY_SKU, { sku: fatherSku, companyId });
const fatherId = father.rows[0]?.articleId;
if (!fatherId) {
throw new Error('Father not found');
@@ -60,6 +61,7 @@ export default function setFatherBySku(provider) {
await runner.query(queries.UPDATE_FATHER_BY_SKU, {
sku,
companyId,
fatherArticleId: fatherId,
fathersort: count,
});