From 68fac2890e671aeac627ee6a7e0d94b28bf5055a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 25 May 2023 14:39:46 +0530 Subject: [PATCH] fix: findone nested fields query param issue Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 2 +- packages/nocodb/src/services/datas.service.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index f5d04ebffe..7e8733105f 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -197,7 +197,7 @@ class BaseModelSqlv2 { ): Promise { const { where, ...rest } = this._getListArgs(args as any); const qb = this.dbDriver(this.tnPath); - await this.selectObject({ qb, validateFormula }); + await this.selectObject({ ...args, qb, validateFormula }); const aliasColObjMap = await this.model.getAliasColObjMap(); const sorts = extractSortsObject(rest?.sort, aliasColObjMap); diff --git a/packages/nocodb/src/services/datas.service.ts b/packages/nocodb/src/services/datas.service.ts index 01c663cee8..fac808d099 100644 --- a/packages/nocodb/src/services/datas.service.ts +++ b/packages/nocodb/src/services/datas.service.ts @@ -186,7 +186,7 @@ export class DatasService { }); const data = await baseModel.findOne({ ...args, dependencyFields }); - return data ? await nocoExecute(ast, data, {}, {}) : {}; + return data ? await nocoExecute(ast, data, {}, dependencyFields) : {}; } async getDataGroupBy(param: { model: Model; view: View; query?: any }) { @@ -272,9 +272,9 @@ export class DatasService { dbDriver: await NcConnectionMgrv2.get(base), }); - const { ast } = await getAst({ model, query, view }); + const { ast, dependencyFields } = await getAst({ model, query, view }); - const listArgs: any = { ...query }; + const listArgs: any = { ...dependencyFields }; try { listArgs.filterArr = JSON.parse(listArgs.filterArrJson); } catch (e) {}