From bdc6d26cdbea8993cf4332bd9b0062037a7dd783 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 27 Aug 2024 19:58:13 +0000 Subject: [PATCH] fix: support array of where query params --- packages/nocodb/src/db/BaseModelSqlv2.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 1b6aa477d3..b153c8f7d0 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -9886,6 +9886,18 @@ export function extractFilterFromXwhere( return []; } + // if array treat it as `and` group + if (Array.isArray(str)) { + // calling recursively for nested query + return str.map((s) => + extractFilterFromXwhere(s, aliasColObjMap, throwErrorIfInvalid), + ); + } else if (typeof str !== 'string' && throwErrorIfInvalid) { + throw new Error( + 'Invalid filter format. Expected string or array of strings.', + ); + } + let nestedArrayConditions = []; let openIndex = str.indexOf('((');