Browse Source

chore: cleanup & lint

pull/7477/head
Pranav C 9 months ago
parent
commit
f15b924516
  1. 4
      packages/nocodb/src/db/functionMappings/pg.ts
  2. 2
      packages/nocodb/src/models/Model.ts
  3. 4
      packages/nocodb/src/models/View.ts
  4. 7
      packages/nocodb/src/services/forms.service.ts
  5. 7
      packages/nocodb/src/services/galleries.service.ts
  6. 9
      packages/nocodb/src/services/grids.service.ts
  7. 13
      packages/nocodb/src/services/kanbans.service.ts
  8. 6
      packages/nocodb/src/services/maps.service.ts
  9. 2
      packages/nocodb/src/services/tables.service.ts
  10. 2
      tests/playwright/tests/db/features/keyboardShortcuts.spec.ts

4
packages/nocodb/src/db/functionMappings/pg.ts

@ -210,7 +210,9 @@ const pg = {
SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => { SUBSTR: async ({ fn, knex, pt, colAlias }: MapFnArgs) => {
const str = (await fn(pt.arguments[0])).builder; const str = (await fn(pt.arguments[0])).builder;
const positionFrom = (await fn(pt.arguments[1] ?? 1)).builder; const positionFrom = (await fn(pt.arguments[1] ?? 1)).builder;
const numberOfCharacters = pt.arguments[2] ? (await fn(pt.arguments[2])).builder : null; const numberOfCharacters = pt.arguments[2]
? (await fn(pt.arguments[2])).builder
: null;
return { return {
builder: knex.raw( builder: knex.raw(
`SUBSTR(${str}::TEXT, ${positionFrom}${ `SUBSTR(${str}::TEXT, ${positionFrom}${

2
packages/nocodb/src/models/Model.ts

@ -167,7 +167,7 @@ export default class Model implements TableType {
source_id: sourceId, source_id: sourceId,
}, },
{ {
getColumns: async () => insertedColumns getColumns: async () => insertedColumns,
}, },
ncMeta, ncMeta,
); );

4
packages/nocodb/src/models/View.ts

@ -1564,7 +1564,7 @@ export default class View implements ViewType {
viewColumns, viewColumns,
copyFromView, copyFromView,
}: { }: {
copyFromView: View; copyFromView?: View;
columns?: ({ columns?: ({
order?: number; order?: number;
show?; show?;
@ -1923,7 +1923,7 @@ export default class View implements ViewType {
} else { } else {
// populate view columns // populate view columns
await View.bulkColumnInsertToViews( await View.bulkColumnInsertToViews(
{ columns: (await model.getColumns()) as any[], copyFromView }, { columns: (await model.getColumns()) as any[] },
insertedView, insertedView,
); );
} }

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

@ -33,13 +33,6 @@ export class FormsService {
param.body, param.body,
); );
// const view = await View.insert({
// ...param.body,
// // todo: sanitize
// fk_model_id: param.tableId,
// type: ViewTypes.FORM,
// });
const model = await Model.get(param.tableId); const model = await Model.get(param.tableId);
const { id } = await View.insertMetaOnly( const { id } = await View.insertMetaOnly(

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

@ -32,13 +32,6 @@ export class GalleriesService {
'swagger.json#/components/schemas/ViewCreateReq', 'swagger.json#/components/schemas/ViewCreateReq',
param.gallery, param.gallery,
); );
//
// const view = await View.insert({
// ...param.gallery,
// // todo: sanitize
// fk_model_id: param.tableId,
// type: ViewTypes.GALLERY,
// });
const model = await Model.get(param.tableId); const model = await Model.get(param.tableId);

9
packages/nocodb/src/services/grids.service.ts

@ -5,7 +5,7 @@ import type { NcRequest } from '~/interface/config';
import { AppHooksService } from '~/services/app-hooks/app-hooks.service'; import { AppHooksService } from '~/services/app-hooks/app-hooks.service';
import { validatePayload } from '~/helpers'; import { validatePayload } from '~/helpers';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { Column, GridView, Model, View } from '~/models'; import { GridView, Model, View } from '~/models';
import NocoCache from '~/cache/NocoCache'; import NocoCache from '~/cache/NocoCache';
import { CacheScope } from '~/utils/globals'; import { CacheScope } from '~/utils/globals';
@ -22,13 +22,6 @@ export class GridsService {
'swagger.json#/components/schemas/ViewCreateReq', 'swagger.json#/components/schemas/ViewCreateReq',
param.grid, param.grid,
); );
//
// const view = await View.insert({
// ...param.grid,
// // todo: sanitize
// fk_model_id: param.tableId,
// type: ViewTypes.GRID,
// });
const model = await Model.get(param.tableId); const model = await Model.get(param.tableId);

13
packages/nocodb/src/services/kanbans.service.ts

@ -9,9 +9,9 @@ import type { NcRequest } from '~/interface/config';
import { AppHooksService } from '~/services/app-hooks/app-hooks.service'; import { AppHooksService } from '~/services/app-hooks/app-hooks.service';
import { validatePayload } from '~/helpers'; import { validatePayload } from '~/helpers';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { KanbanView, Model, View } from '~/models' import { KanbanView, Model, View } from '~/models';
import NocoCache from '~/cache/NocoCache' import NocoCache from '~/cache/NocoCache';
import { CacheScope } from '~/utils/globals' import { CacheScope } from '~/utils/globals';
@Injectable() @Injectable()
export class KanbansService { export class KanbansService {
@ -32,13 +32,6 @@ export class KanbansService {
param.kanban, param.kanban,
); );
// const view = await View.insert({
// ...param.kanban,
// // todo: sanitize
// fk_model_id: param.tableId,
// type: ViewTypes.KANBAN,
// });
const model = await Model.get(param.tableId); const model = await Model.get(param.tableId);
const { id } = await View.insertMetaOnly( const { id } = await View.insertMetaOnly(

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

@ -27,12 +27,6 @@ export class MapsService {
'swagger.json#/components/schemas/ViewCreateReq', 'swagger.json#/components/schemas/ViewCreateReq',
param.map, param.map,
); );
// const view = await View.insert({
// ...param.map,
// // todo: sanitize
// fk_model_id: param.tableId,
// type: ViewTypes.MAP,
// });
const model = await Model.get(param.tableId); const model = await Model.get(param.tableId);

2
packages/nocodb/src/services/tables.service.ts

@ -613,6 +613,7 @@ export class TablesService {
system?: boolean; system?: boolean;
} }
>; >;
if (!source.isMeta()) { if (!source.isMeta()) {
columns = ( columns = (
await sqlMgr.sqlOpPlus(source, 'columnList', { await sqlMgr.sqlOpPlus(source, 'columnList', {
@ -621,6 +622,7 @@ export class TablesService {
}) })
)?.data?.list; )?.data?.list;
} }
const tables = await Model.list({ const tables = await Model.list({
base_id: base.id, base_id: base.id,
source_id: source.id, source_id: source.id,

2
tests/playwright/tests/db/features/keyboardShortcuts.spec.ts

@ -328,7 +328,7 @@ test.describe('Clipboard support', () => {
test('multiple cells - horizontal, all data types', async ({ page }) => { test('multiple cells - horizontal, all data types', async ({ page }) => {
// skip for local run (clipboard access issue in headless mode) // skip for local run (clipboard access issue in headless mode)
if (!process.env.CI && config.use.headless) { if (!process.env.CI && config.use.headless) {
// test.skip(); test.skip();
} }
// click first cell, press `Ctrl A` and `Ctrl C` // click first cell, press `Ctrl A` and `Ctrl C`

Loading…
Cancel
Save