notNull检查时处理null属性

This commit is contained in:
Xu Chang 2023-10-08 13:31:44 +08:00
parent 158f21e706
commit 6b9aabec7c
2 changed files with 2 additions and 2 deletions

View File

@ -426,7 +426,7 @@ function createCreateCheckers(schema) {
action: 'create',
checker: (data) => {
const checkData = (data2) => {
const illegalNullAttrs = (0, lodash_1.difference)(notNullAttrs, Object.keys(data2));
const illegalNullAttrs = (0, lodash_1.difference)(notNullAttrs, Object.keys(data2).filter(ele => data2[ele] !== null));
if (illegalNullAttrs.length > 0) {
const emtpyAttrs = [];
// 要处理多对一的cascade create

View File

@ -476,7 +476,7 @@ export function createCreateCheckers<ED extends EntityDict & BaseEntityDict, Cxt
action: 'create' as ED[keyof ED]['Action'],
checker: (data) => {
const checkData = (data2: ED[keyof ED]['CreateSingle']['data']) => {
const illegalNullAttrs = difference(notNullAttrs, Object.keys(data2));
const illegalNullAttrs = difference(notNullAttrs, Object.keys(data2).filter(ele => data2[ele] !== null));
if (illegalNullAttrs.length > 0) {
const emtpyAttrs: string[] = [];
// 要处理多对一的cascade create