From 62da4c15a1cd31fefa7eda6880949c06c98454ce Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 31 May 2023 18:44:32 +0800 Subject: [PATCH] refactor(nocodb): lint --- packages/nocodb/src/controllers/org-users.controller.ts | 1 - packages/nocodb/src/controllers/projects.controller.ts | 2 +- packages/nocodb/src/controllers/users/users.controller.ts | 6 +++--- packages/nocodb/src/db/BaseModelSqlv2.ts | 8 +------- .../extract-project-id/extract-project-id.middleware.ts | 1 - packages/nocodb/src/models/Model.ts | 1 - 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/nocodb/src/controllers/org-users.controller.ts b/packages/nocodb/src/controllers/org-users.controller.ts index 7ea86c037e..da860f7ca7 100644 --- a/packages/nocodb/src/controllers/org-users.controller.ts +++ b/packages/nocodb/src/controllers/org-users.controller.ts @@ -10,7 +10,6 @@ import { Request, UseGuards, } from '@nestjs/common'; -import { AuthGuard } from '@nestjs/passport'; import { OrgUserRoles } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; diff --git a/packages/nocodb/src/controllers/projects.controller.ts b/packages/nocodb/src/controllers/projects.controller.ts index afde4b59a5..2599430f1b 100644 --- a/packages/nocodb/src/controllers/projects.controller.ts +++ b/packages/nocodb/src/controllers/projects.controller.ts @@ -16,8 +16,8 @@ import { ProjectReqType } from 'nocodb-sdk'; import { GlobalGuard } from '../guards/global/global.guard'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { - ExtractProjectIdMiddleware, Acl, + ExtractProjectIdMiddleware, } from '../middlewares/extract-project-id/extract-project-id.middleware'; import Noco from '../Noco'; import { packageVersion } from '../utils/packageVersion'; diff --git a/packages/nocodb/src/controllers/users/users.controller.ts b/packages/nocodb/src/controllers/users/users.controller.ts index e618890e7a..0c8f153c78 100644 --- a/packages/nocodb/src/controllers/users/users.controller.ts +++ b/packages/nocodb/src/controllers/users/users.controller.ts @@ -94,7 +94,7 @@ export class UsersController { @Get('/auth/google') @UseGuards(AuthGuard('google')) - googleAuthenticate(@Request() req) { + googleAuthenticate() { // google strategy will take care the request } @@ -116,7 +116,7 @@ export class UsersController { @UseGuards(GlobalGuard) @Acl('passwordChange') @HttpCode(200) - async passwordChange(@Request() req: any, @Body() body: any): Promise { + async passwordChange(@Request() req: any): Promise { if (!(req as any).isAuthenticated()) { NcError.forbidden('Not allowed'); } @@ -136,7 +136,7 @@ export class UsersController { '/api/v1/auth/password/forgot', ]) @HttpCode(200) - async passwordForgot(@Request() req: any, @Body() body: any): Promise { + async passwordForgot(@Request() req: any): Promise { await this.usersService.passwordForgot({ siteUrl: (req as any).ncSiteUrl, body: req.body, diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 7d730abc0f..86e2a96431 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -48,7 +48,7 @@ import type { SelectOption, } from '../models'; import type { Knex } from 'knex'; -import type { BoolType, SortType } from 'nocodb-sdk'; +import type { SortType } from 'nocodb-sdk'; dayjs.extend(utc); dayjs.extend(timezone); @@ -1352,12 +1352,6 @@ class BaseModelSqlv2 { const columns = await this.model.getColumns(); for (const column of columns) { switch (column.uidt) { - case UITypes.Rollup: - { - // @ts-ignore - const colOptions: RollupColumn = await column.getColOptions(); - } - break; case UITypes.Lookup: { // @ts-ignore diff --git a/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts b/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts index 52f9cf9cc6..d797e146c7 100644 --- a/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts +++ b/packages/nocodb/src/middlewares/extract-project-id/extract-project-id.middleware.ts @@ -212,7 +212,6 @@ export class AclMiddleware implements NestInterceptor { ); const req = context.switchToHttp().getRequest(); - const res = context.switchToHttp().getResponse(); req.customProperty = 'This is a custom property'; const roles: Record = extractRolesObj(req.user?.roles); diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts index 751ae8a438..0826fd538a 100644 --- a/packages/nocodb/src/models/Model.ts +++ b/packages/nocodb/src/models/Model.ts @@ -16,7 +16,6 @@ import { sanitize } from '../helpers/sqlSanitize'; import { extractProps } from '../helpers/extractProps'; import Audit from './Audit'; import View from './View'; -import Base from './Base'; import Column from './Column'; import type { BoolType, TableReqType, TableType } from 'nocodb-sdk'; import type { XKnex } from '../db/CustomKnex';