Browse Source

fix(nocodb): use dependencyFields from AST instead of param.query

pull/5490/head
Wing-Kam Wong 2 years ago
parent
commit
7ca9c59618
  1. 20
      packages/nocodb/src/lib/services/public/publicData.svc.ts

20
packages/nocodb/src/lib/services/public/publicData.svc.ts

@ -69,10 +69,7 @@ export async function dataList(param: {
count = await baseModel.count(listArgs);
} catch (e) {
console.log(e);
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
NcError.internalServerError('Please try after some time');
NcError.internalServerError('Please check server log for more details');
}
return new PagedResponseImpl(data, { ...param.query, count });
@ -294,6 +291,7 @@ export async function relDataList(param: {
}
const column = await Column.get({ colId: param.columnId });
const colOptions = await column.getColOptions<LinkToAnotherRecordColumn>();
const model = await colOptions.getRelatedTable();
@ -306,25 +304,27 @@ export async function relDataList(param: {
dbDriver: await NcConnectionMgrv2.get(base),
});
const { ast } = await getAst({
const { ast, dependencyFields } = await getAst({
query: param.query,
model,
extractOnlyPrimaries: true,
});
let data = [];
let count = 0;
try {
data = data = await nocoExecute(
ast,
await baseModel.list(param.query),
await baseModel.list(dependencyFields),
{},
param.query
dependencyFields
);
count = await baseModel.count(param.query);
count = await baseModel.count(dependencyFields);
} catch (e) {
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
console.log(e);
NcError.internalServerError('Please check server log for more details');
}
return new PagedResponseImpl(data, { ...param.query, count });

Loading…
Cancel
Save