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);
|
seen.add(categoryId);
|
||||||
normalized.push(categoryId);
|
normalized.push(categoryId);
|
||||||
}
|
}
|
||||||
|
if (normalized.length === 0) {
|
||||||
|
throw new Error('Article must have at least one category');
|
||||||
|
}
|
||||||
|
|
||||||
const { articleId, languageId, companyId } = await resolve(
|
const { articleId, languageId, companyId } = await resolve(
|
||||||
googleAuthId,
|
googleAuthId,
|
||||||
|
|||||||
Reference in New Issue
Block a user