Require at least one category when setting article categories
Prevents articles from becoming unreachable by rejecting empty categoryIds arrays in setCategoryIdsBySku.
This commit is contained in:
@@ -25,6 +25,9 @@ export default function setCategoryIdsBySku(pool) {
|
||||
seen.add(categoryId);
|
||||
normalized.push(categoryId);
|
||||
}
|
||||
if (normalized.length === 0) {
|
||||
throw new Error('Article must have at least one category');
|
||||
}
|
||||
|
||||
const { articleId, languageId, companyId } = await resolve(
|
||||
googleAuthId,
|
||||
|
||||
Reference in New Issue
Block a user