u
This commit is contained in:
@@ -27,7 +27,8 @@ export default function setByArticleSku(provider) {
|
||||
|
||||
/**
|
||||
* Replaces all properties for an article by its SKU.
|
||||
* Enforces exclusive flag on property names.
|
||||
* Enforces exclusive flag on property names. An exclusive property that already has a value
|
||||
* is never overwritten: a different value throws `Exclusive property cannot be overwritten: <name>`.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {string} sku - The article SKU.
|
||||
@@ -79,6 +80,12 @@ export default function setByArticleSku(provider) {
|
||||
}
|
||||
|
||||
const value = item.value != null ? String(item.value).trim() : '';
|
||||
if (isExclusive) {
|
||||
const existing = oldProps.find((p) => p.propertyId === propertyId);
|
||||
if (existing && existing.value !== '' && existing.value !== value) {
|
||||
throw new Error(`Exclusive property cannot be overwritten: ${prop.name}`);
|
||||
}
|
||||
}
|
||||
const sort = item.sort != null && Number.isInteger(item.sort) ? item.sort : i;
|
||||
validated.push({
|
||||
propertyId,
|
||||
|
||||
Reference in New Issue
Block a user