u
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import {
|
||||
ADD_CATEGORY as MSSQL_ADD_CATEGORY,
|
||||
DELETE_CATEGORIES_BY_ARTICLE as MSSQL_DELETE_CATEGORIES,
|
||||
TOUCH_UPDATED_AT as MSSQL_TOUCH,
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import {
|
||||
ADD_CATEGORY as SQLITE_ADD_CATEGORY,
|
||||
DELETE_CATEGORIES_BY_ARTICLE as SQLITE_DELETE_CATEGORIES,
|
||||
TOUCH_UPDATED_AT as SQLITE_TOUCH,
|
||||
} from '../../providers/sqlite3/queries/article.js';
|
||||
import resolveCategoryAccess from '../category/resolveCategoryAccess.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
@@ -20,6 +22,7 @@ export default function setCategoryIdsBySku(provider) {
|
||||
|
||||
const addCategorySql = isSqlite ? SQLITE_ADD_CATEGORY : MSSQL_ADD_CATEGORY;
|
||||
const deleteCategoriesSql = isSqlite ? SQLITE_DELETE_CATEGORIES : MSSQL_DELETE_CATEGORIES;
|
||||
const touchArticleSql = isSqlite ? SQLITE_TOUCH : MSSQL_TOUCH;
|
||||
|
||||
/**
|
||||
* Replaces the category membership of an article by its SKU.
|
||||
@@ -91,6 +94,9 @@ export default function setCategoryIdsBySku(provider) {
|
||||
newCategoryIds: normalized,
|
||||
});
|
||||
|
||||
// Touch article updated_at so POS and other consumers pick up category assignment changes
|
||||
await runner.query(touchArticleSql, { articleId });
|
||||
|
||||
const article = await load(articleId, languageId, runner);
|
||||
if (!article) {
|
||||
throw new Error('Article not found');
|
||||
|
||||
Reference in New Issue
Block a user