Browse Source

fix: findone nested fields query param issue

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5735/head
Pranav C 1 year ago
parent
commit
68fac2890e
  1. 2
      packages/nocodb/src/db/BaseModelSqlv2.ts
  2. 6
      packages/nocodb/src/services/datas.service.ts

2
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -197,7 +197,7 @@ class BaseModelSqlv2 {
): Promise<any> { ): Promise<any> {
const { where, ...rest } = this._getListArgs(args as any); const { where, ...rest } = this._getListArgs(args as any);
const qb = this.dbDriver(this.tnPath); const qb = this.dbDriver(this.tnPath);
await this.selectObject({ qb, validateFormula }); await this.selectObject({ ...args, qb, validateFormula });
const aliasColObjMap = await this.model.getAliasColObjMap(); const aliasColObjMap = await this.model.getAliasColObjMap();
const sorts = extractSortsObject(rest?.sort, aliasColObjMap); const sorts = extractSortsObject(rest?.sort, aliasColObjMap);

6
packages/nocodb/src/services/datas.service.ts

@ -186,7 +186,7 @@ export class DatasService {
}); });
const data = await baseModel.findOne({ ...args, dependencyFields }); 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 }) { async getDataGroupBy(param: { model: Model; view: View; query?: any }) {
@ -272,9 +272,9 @@ export class DatasService {
dbDriver: await NcConnectionMgrv2.get(base), 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 { try {
listArgs.filterArr = JSON.parse(listArgs.filterArrJson); listArgs.filterArr = JSON.parse(listArgs.filterArrJson);
} catch (e) {} } catch (e) {}

Loading…
Cancel
Save