diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts index 3a2e9d43f3..cf1d836dbb 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts @@ -2055,8 +2055,7 @@ function extractCondition(nestedArrayConditions, aliasColObjMap) { // eslint-disable-next-line prefer-const let [logicOp, alias, op, value] = str.match(/(?:~(and|or|not))?\((.*?),(\w+),(.*)\)/)?.slice(1) || []; - if (op === 'is') op = 'is' + value; - else if (op === 'in') value = value.split(','); + if (op === 'in') value = value.split(','); return new Filter({ comparison_op: op, diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts index a2b3ea05be..34d38e7acc 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts @@ -432,18 +432,20 @@ const appendWhereCondition = function( ); break; case '': - const column = columnAliases[matches[2]] || matches[2]; - const operator = opMapping[matches[3]]; - const target = matches[4]; - if (matches[3] == 'like' && clientType === 'pg') { - // handle uuid case - knexRef[`${key}`]( - knexRef?.client.raw(`??::TEXT ${operator} '${target}'`, [ - column - ]) - ); - } else { - knexRef[`${key}`](column, operator, target); + { + const column = columnAliases[matches[2]] || matches[2]; + const operator = opMapping[matches[3]]; + const target = matches[4]; + if (matches[3] == 'like' && clientType === 'pg') { + // handle uuid case + knexRef[`${key}`]( + knexRef?.client.raw(`??::TEXT ${operator} '${target}'`, [ + column + ]) + ); + } else { + knexRef[`${key}`](column, operator, target); + } } break; default: diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts index eba35ee7f4..960b0f4ae1 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts @@ -251,9 +251,19 @@ const parseConditionV2 = async ( else if (filter.value === 'notnull') qb = qb.whereNotNull(customWhereClause || field); else if (filter.value === 'empty') - qb = qb.where(customWhereClause || field); + qb = qb.where(customWhereClause || field, ''); else if (filter.value === 'notempty') - qb = qb.whereNot(customWhereClause || field); + qb = qb.whereNot(customWhereClause || field, ''); + break; + case 'isnot': + if (filter.value === 'null') + qb = qb.whereNotNull(customWhereClause || field); + else if (filter.value === 'notnull') + qb = qb.whereNull(customWhereClause || field); + else if (filter.value === 'empty') + qb = qb.whereNot(customWhereClause || field, ''); + else if (filter.value === 'notempty') + qb = qb.where(customWhereClause || field, ''); break; case 'lt': qb = qb.where(field, customWhereClause ? '>' : '<', val); diff --git a/packages/nocodb/src/lib/noco-models/Filter.ts b/packages/nocodb/src/lib/noco-models/Filter.ts index b9c2a95802..3f930bfac6 100644 --- a/packages/nocodb/src/lib/noco-models/Filter.ts +++ b/packages/nocodb/src/lib/noco-models/Filter.ts @@ -37,6 +37,7 @@ export default class Filter { | 'ge' | 'le' | 'in' + | 'isnot' | 'is'; value?: string; diff --git a/packages/nocodb/src/lib/utils/projectAcl.ts b/packages/nocodb/src/lib/utils/projectAcl.ts index 068694b6be..9749555c33 100644 --- a/packages/nocodb/src/lib/utils/projectAcl.ts +++ b/packages/nocodb/src/lib/utils/projectAcl.ts @@ -124,7 +124,8 @@ export default { bulkDataDelete: true, bulkDataDeleteAll: true, relationDataRemove: true, - relationDataAdd: true + relationDataAdd: true, + dataCount: true }, commenter: { formViewGet: true, @@ -171,7 +172,8 @@ export default { xcModelRowAuditAndCommentList: true, xcAuditCommentInsert: true, xcAuditModelCommentsCount: true, - xcExportAsCsv: true + xcExportAsCsv: true, + dataCount: true }, viewer: { formViewGet: true, @@ -213,7 +215,8 @@ export default { relationListAll: true, indexList: true, list: true, - xcExportAsCsv: true + xcExportAsCsv: true, + dataCount: true }, user_new: { passwordChange: true,