更新了一个异常的格式

This commit is contained in:
Xu Chang 2025-02-27 14:22:04 +08:00
parent ebfc019722
commit beb7f589d1
2 changed files with 6 additions and 6 deletions

View File

@ -326,7 +326,7 @@ function createAttrUpdateCheckers(schema, attrUpdateMatrix) {
const attrs = Object.keys(data);
const extras = (0, lodash_1.difference)(attrs, updateAttrs);
if (extras.length > 0) {
throw new types_1.OakAttrCantUpdateException(entity, extras, '更新了不允许的属性');
throw new types_1.OakAttrCantUpdateException(entity, extras);
}
const condition = attrs.map(ele => matrix[ele]);
const actions = condition.map(ele => ele?.actions).filter(ele => !!ele);
@ -336,7 +336,7 @@ function createAttrUpdateCheckers(schema, attrUpdateMatrix) {
if (!a.includes(action)) {
// 找到不满足的那个attr
const attrsIllegal = attrs.filter((attr) => matrix[attr]?.actions && !matrix[attr]?.actions?.includes(action));
throw new types_1.OakAttrCantUpdateException(entity, attrsIllegal, `${attrsIllegal.join(',')}不允许被${action}动作更新`);
throw new types_1.OakAttrCantUpdateException(entity, attrsIllegal);
}
}
const filters = condition.map(ele => {
@ -354,7 +354,7 @@ function createAttrUpdateCheckers(schema, attrUpdateMatrix) {
if (attrs.length > 1) {
return cascadelyCheckUpdateFilters(entity, schema, data, filter, matrix, attrs, context);
}
throw new types_1.OakAttrCantUpdateException(entity, attrs, '更新的行当前属性不满足约束,请仔细检查数据');
throw new types_1.OakAttrCantUpdateException(entity, attrs);
}
});
}

View File

@ -398,7 +398,7 @@ function createAttrUpdateCheckers<ED extends EntityDict & BaseEntityDict, Cxt ex
const attrs = Object.keys(data);
const extras = difference(attrs, updateAttrs);
if (extras.length > 0) {
throw new OakAttrCantUpdateException(entity, extras, '更新了不允许的属性');
throw new OakAttrCantUpdateException(entity, extras);
}
const condition = attrs.map(ele => matrix[ele]!);
const actions = condition.map(ele => ele?.actions).filter(ele => !!ele);
@ -410,7 +410,7 @@ function createAttrUpdateCheckers<ED extends EntityDict & BaseEntityDict, Cxt ex
const attrsIllegal = attrs.filter(
(attr) => matrix[attr]?.actions && !matrix[attr]?.actions?.includes(action!)
);
throw new OakAttrCantUpdateException(entity, attrsIllegal, `${attrsIllegal.join(',')}不允许被${action}动作更新`);
throw new OakAttrCantUpdateException(entity, attrsIllegal);
}
}
const filters = condition.map(ele => {
@ -430,7 +430,7 @@ function createAttrUpdateCheckers<ED extends EntityDict & BaseEntityDict, Cxt ex
return cascadelyCheckUpdateFilters(entity, schema, data as ED[keyof ED]['Update']['data'],
filter, matrix, attrs, context);
}
throw new OakAttrCantUpdateException(entity, attrs, '更新的行当前属性不满足约束,请仔细检查数据');
throw new OakAttrCantUpdateException(entity, attrs);
}
}
);