u
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user