Browse Source

chore: lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6770/head
Pranav C 1 year ago
parent
commit
fe94f7c4be
  1. 6
      packages/nocodb/src/controllers/data-table.controller.ts
  2. 12
      packages/nocodb/src/db/BaseModelSqlv2.ts
  3. 6
      packages/nocodb/src/db/conditionV2.ts
  4. 7
      packages/nocodb/src/services/datas.service.ts

6
packages/nocodb/src/controllers/data-table.controller.ts

@ -151,7 +151,8 @@ export class DataTableController {
@Query('viewId') viewId: string, @Query('viewId') viewId: string,
@Param('columnId') columnId: string, @Param('columnId') columnId: string,
@Param('rowId') rowId: string, @Param('rowId') rowId: string,
@Body() refRowIds: string | string[] | number | number[] | Record<string, any>, @Body()
refRowIds: string | string[] | number | number[] | Record<string, any>,
) { ) {
return await this.dataTableService.nestedLink({ return await this.dataTableService.nestedLink({
modelId, modelId,
@ -172,7 +173,8 @@ export class DataTableController {
@Query('viewId') viewId: string, @Query('viewId') viewId: string,
@Param('columnId') columnId: string, @Param('columnId') columnId: string,
@Param('rowId') rowId: string, @Param('rowId') rowId: string,
@Body() refRowIds: string | string[] | number | number[] | Record<string, any>, @Body()
refRowIds: string | string[] | number | number[] | Record<string, any>,
) { ) {
return await this.dataTableService.nestedUnlink({ return await this.dataTableService.nestedUnlink({
modelId, modelId,

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

@ -155,7 +155,7 @@ class BaseModelSqlv2 {
model: this.model, model: this.model,
view: ignoreView ? null : this.viewId && (await View.get(this.viewId)), view: ignoreView ? null : this.viewId && (await View.get(this.viewId)),
getHiddenColumn, getHiddenColumn,
throwErrorIfInvalidParams throwErrorIfInvalidParams,
}); });
await this.selectObject({ await this.selectObject({
@ -381,7 +381,11 @@ class BaseModelSqlv2 {
// qb.xwhere(where, await this.model.getAliasColMapping()); // qb.xwhere(where, await this.model.getAliasColMapping());
const aliasColObjMap = await this.model.getAliasColObjMap(); const aliasColObjMap = await this.model.getAliasColObjMap();
const filterObj = extractFilterFromXwhere(where, aliasColObjMap,throwErrorIfInvalidParams); const filterObj = extractFilterFromXwhere(
where,
aliasColObjMap,
throwErrorIfInvalidParams,
);
if (!ignoreViewFilterAndSort && this.viewId) { if (!ignoreViewFilterAndSort && this.viewId) {
await conditionV2( await conditionV2(
@ -406,7 +410,7 @@ class BaseModelSqlv2 {
], ],
qb, qb,
undefined, undefined,
throwErrorIfInvalidParams throwErrorIfInvalidParams,
); );
} else { } else {
await conditionV2( await conditionV2(
@ -426,7 +430,7 @@ class BaseModelSqlv2 {
], ],
qb, qb,
undefined, undefined,
throwErrorIfInvalidParams throwErrorIfInvalidParams,
); );
} }

6
packages/nocodb/src/db/conditionV2.ts

@ -2,13 +2,13 @@ import { isNumericCol, RelationTypes, UITypes } from 'nocodb-sdk';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
// import customParseFormat from 'dayjs/plugin/customParseFormat.js'; // import customParseFormat from 'dayjs/plugin/customParseFormat.js';
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import { NcError } from '~/helpers/catchError'
import type LinkToAnotherRecordColumn from '~/models/LinkToAnotherRecordColumn'; import type LinkToAnotherRecordColumn from '~/models/LinkToAnotherRecordColumn';
import type { Knex } from 'knex'; import type { Knex } from 'knex';
import type Column from '~/models/Column'; import type Column from '~/models/Column';
import type LookupColumn from '~/models/LookupColumn'; import type LookupColumn from '~/models/LookupColumn';
import type RollupColumn from '~/models/RollupColumn'; import type RollupColumn from '~/models/RollupColumn';
import type FormulaColumn from '~/models/FormulaColumn'; import type FormulaColumn from '~/models/FormulaColumn';
import { NcError } from '~/helpers/catchError';
import formulaQueryBuilderv2 from '~/db/formulav2/formulaQueryBuilderv2'; import formulaQueryBuilderv2 from '~/db/formulav2/formulaQueryBuilderv2';
import genRollupSelectv2 from '~/db/genRollupSelectv2'; import genRollupSelectv2 from '~/db/genRollupSelectv2';
import { sanitize } from '~/helpers/sqlSanitize'; import { sanitize } from '~/helpers/sqlSanitize';
@ -115,7 +115,9 @@ const parseConditionV2 = async (
const column = await filter.getColumn(); const column = await filter.getColumn();
if (!column) { if (!column) {
if (throwErrorIfInvalid) { if (throwErrorIfInvalid) {
NcError.unprocessableEntity(`Invalid column id '${filter.fk_column_id}' in filter`); NcError.unprocessableEntity(
`Invalid column id '${filter.fk_column_id}' in filter`,
);
} }
return; return;
} }

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

@ -147,7 +147,12 @@ export class DatasService {
dbDriver: await NcConnectionMgrv2.get(source), dbDriver: await NcConnectionMgrv2.get(source),
})); }));
const { ast, dependencyFields } = await getAst({ model, query, view, throwErrorIfInvalidParams: param.throwErrorIfInvalidParams }); const { ast, dependencyFields } = await getAst({
model,
query,
view,
throwErrorIfInvalidParams: param.throwErrorIfInvalidParams,
});
const listArgs: any = dependencyFields; const listArgs: any = dependencyFields;
try { try {

Loading…
Cancel
Save