From 9c1308b8b6c6296da4ecdfca39842c95da850596 Mon Sep 17 00:00:00 2001 From: Aleksandar Stanisic Date: Mon, 21 Dec 2020 00:06:52 +0100 Subject: [PATCH] Enable reversing _null, _nnull, _empty and _nempty --- api/src/utils/apply-query.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/src/utils/apply-query.ts b/api/src/utils/apply-query.ts index 0eab1cd823..3128fca41b 100644 --- a/api/src/utils/apply-query.ts +++ b/api/src/utils/apply-query.ts @@ -193,22 +193,22 @@ export async function applyFilter(knex: Knex, rootQuery: QueryBuilder, rootFilte dbQuery[logical].whereNotIn(key, value as string[]); } - if (operator === '_null') { + if (operator === '_null' || (operator === '_nnull' && compareValue === false)) { dbQuery[logical].whereNull(key); } - if (operator === '_nnull') { + if (operator === '_nnull' || (operator === '_null' && compareValue === false)) { dbQuery[logical].whereNotNull(key); } - if (operator === '_empty') { + if (operator === '_empty' || (operator === '_nempty' && compareValue === false)) { dbQuery[logical].andWhere((query) => { query.whereNull(key); query.orWhere(key, '=', ''); }); } - if (operator === '_nempty') { + if (operator === '_nempty' || (operator === '_empty' && compareValue === false)) { dbQuery[logical].andWhere((query) => { query.whereNotNull(key); query.orWhere(key, '!=', '');