Browse Source

feat: allow reusing baseModel for getDataList

Signed-off-by: mertmit <mertmit99@gmail.com>
feat/export-nest
mertmit 2 years ago
parent
commit
b0cf08122b
  1. 20
      packages/nocodb-nest/src/services/datas.service.ts

20
packages/nocodb-nest/src/services/datas.service.ts

@ -13,6 +13,7 @@ import {
getViewAndModelByAliasOrId,
serializeCellValue,
} from '../modules/datas/helpers';
import type { BaseModelSqlv2 } from '../db/BaseModelSqlv2';
import type { PathParams } from '../modules/datas/helpers';
import type { LinkToAnotherRecordColumn, LookupColumn } from '../models';
@ -110,16 +111,23 @@ export class DatasService {
return await baseModel.delByPk(param.rowId, null, param.cookie);
}
async getDataList(param: { model: Model; view: View; query: any }) {
async getDataList(param: {
model: Model;
view: View;
query: any;
baseModel?: BaseModelSqlv2;
}) {
const { model, view, query = {} } = param;
const base = await Base.get(model.base_id);
const baseModel = await Model.getBaseModelSQL({
id: model.id,
viewId: view?.id,
dbDriver: await NcConnectionMgrv2.get(base),
});
const baseModel =
param.baseModel ||
(await Model.getBaseModelSQL({
id: model.id,
viewId: view?.id,
dbDriver: await NcConnectionMgrv2.get(base),
}));
const { ast, dependencyFields } = await getAst({ model, query, view });

Loading…
Cancel
Save