Browse Source

fix: corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
test/query-opt-imp
Pranav C 2 years ago
parent
commit
8d86348fe4
  1. 8
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  2. 21
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

8
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -3,16 +3,17 @@ import groupBy from 'lodash/groupBy';
import DataLoader from 'dataloader';
import {
AuditOperationSubTypes,
AuditOperationTypes,
AuditOperationTypes, isSystemColumn,
isVirtualCol,
RelationTypes,
UITypes,
ViewTypes,
} from 'nocodb-sdk';
} from 'nocodb-sdk'
import ejs from 'ejs';
import Validator from 'validator';
import { customAlphabet } from 'nanoid';
import DOMPurify from 'isomorphic-dompurify';
import { GridViewColumn } from '../../../../models'
import Model from '../../../../models/Model';
import Column from '../../../../models/Column';
import Filter, {
@ -1451,7 +1452,6 @@ class BaseModelSqlv2 {
// add option to get only pk and pv
public async selectObject({
qb,
columns: _columns,,
columns: _columns,
fields: _fields,
extractPkAndPv,
@ -1469,7 +1469,7 @@ class BaseModelSqlv2 {
const res = {};
// const columns = _columns ?? (await this.model.getColumns());
// for (const column of columns) {
const viewOrTableColumns = viewColumns || (await this.model.getColumns());
const viewOrTableColumns = _columns || viewColumns || (await this.model.getColumns());
for (const viewOrTableColumn of viewOrTableColumns) {
const column =
viewOrTableColumn instanceof Column

21
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/helpers/getAst.ts

@ -1,7 +1,11 @@
import { isSystemColumn, UITypes } from 'nocodb-sdk';
import View from '../../../../../models/View';
import type Model from '../../../../../models/Model';
import type LinkToAnotherRecordColumn from '../../../../../models/LinkToAnotherRecordColumn';
import { isSystemColumn, RelationTypes, UITypes } from 'nocodb-sdk';
import { View } from '../../../../../models';
import type {
Column,
LinkToAnotherRecordColumn,
LookupColumn,
Model,
} from '../../../../../models';
const getAst = async ({
query,
@ -34,7 +38,8 @@ const getAst = async ({
await Promise.all(
model.primaryKeys.map((c) => extractDependencies(c, dependencyFields))
);
await extractDependencies(model.primaryValue, dependencyFields);
await extractDependencies(model.displayValue, dependencyFields);
return { ast, dependencyFields };
}
@ -94,11 +99,11 @@ const getAst = async ({
model,
query: query?.nested?.[col.title],
extractOnlyPrimaries: nestedFields !== '*',
dependencyFields:(dependencyFields.nested[col.title] =
dependencyFields.nested[col.title] || {
dependencyFields: (dependencyFields.nested[col.title] = dependencyFields
.nested[col.title] || {
nested: {},
fields: new Set(),
})
}),
});
}

Loading…
Cancel
Save