diff --git a/packages/core/database/src/operators/boolean.ts b/packages/core/database/src/operators/boolean.ts new file mode 100644 index 000000000..a37c6d64f --- /dev/null +++ b/packages/core/database/src/operators/boolean.ts @@ -0,0 +1,18 @@ +import { Op } from 'sequelize'; + +export default { + $isFalsy() { + return { + [Op.or]: { + [Op.is]: null, + [Op.eq]: false, + }, + }; + }, + + $isTruly() { + return { + [Op.eq]: true, + }; + }, +}; diff --git a/packages/core/database/src/operators/index.ts b/packages/core/database/src/operators/index.ts index db4cbca8a..72b1ace2c 100644 --- a/packages/core/database/src/operators/index.ts +++ b/packages/core/database/src/operators/index.ts @@ -6,4 +6,5 @@ export default { ...require('./string').default, ...require('./ne').default, ...require('./notIn').default, + ...require('./boolean').default, };