diff --git a/packages/nocodb-nest/src/app.module.ts b/packages/nocodb-nest/src/app.module.ts index a70eda1fd5..33d42d8ef8 100644 --- a/packages/nocodb-nest/src/app.module.ts +++ b/packages/nocodb-nest/src/app.module.ts @@ -1,69 +1,69 @@ -import { Module, RequestMethod } from '@nestjs/common' -import { APP_FILTER, APP_GUARD } from '@nestjs/core' -import { ExtractJwt } from 'passport-jwt' -import { Connection } from './connection/connection' -import { GlobalExceptionFilter } from './filters/global-exception/global-exception.filter' -import { GlobalGuard } from './guards/global/global.guard' -import { GlobalMiddleware } from './middlewares/global/global.middleware' -import { AuthModule } from './modules/auth/auth.module' -import { ExtractProjectIdMiddleware } from './middlewares/extract-project-id/extract-project-id.middleware' -import { AuthService } from './modules/auth/auth.service' -import { UsersModule } from './modules/users/users.module' -import { MetaService } from './meta/meta.service' -import { UsersService } from './modules/users/users.service' -import { UtilsModule } from './modules/utils/utils.module' -import { ProjectsModule } from './modules/projects/projects.module' -import Noco from './Noco' -import { JwtStrategy } from './strategies/jwt.strategy' -import { TablesModule } from './modules/tables/tables.module' -import { ViewsModule } from './modules/views/views.module' -import { FiltersModule } from './modules/filters/filters.module' -import { SortsModule } from './modules/sorts/sorts.module' -import { ColumnsModule } from './modules/columns/columns.module' -import { ViewColumnsModule } from './modules/view-columns/view-columns.module' -import { BasesModule } from './modules/bases/bases.module' -import { HooksModule } from './modules/hooks/hooks.module' -import { SharedBasesModule } from './modules/shared-bases/shared-bases.module' -import { FormsModule } from './modules/forms/forms.module' -import { GridsModule } from './modules/grids/grids.module' -import { KanbansModule } from './modules/kanbans/kanbans.module' -import { GalleriesModule } from './modules/galleries/galleries.module' -import { FormColumnsModule } from './modules/form-columns/form-columns.module' -import { GridColumnsModule } from './modules/grid-columns/grid-columns.module' -import { MapsModule } from './modules/maps/maps.module' -import { ProjectUsersModule } from './modules/project-users/project-users.module' -import { ModelVisibilitiesModule } from './modules/model-visibilities/model-visibilities.module' -import { HookFiltersModule } from './modules/hook-filters/hook-filters.module' -import { ApiTokensModule } from './modules/api-tokens/api-tokens.module' -import { AttachmentsModule } from './modules/attachments/attachments.module' -import { OrgLcenseModule } from './modules/org-lcense/org-lcense.module' -import { OrgTokensModule } from './modules/org-tokens/org-tokens.module' -import { OrgUsersModule } from './modules/org-users/org-users.module' -import { MetaDiffsModule } from './modules/meta-diffs/meta-diffs.module' -import { AuditsModule } from './modules/audits/audits.module' -import { DatasModule } from './modules/datas/datas.module' -import { ApiDocsModule } from './modules/api-docs/api-docs.module' -import { PublicMetasModule } from './modules/public-metas/public-metas.module' -import { PublicDatasModule } from './modules/public-datas/public-datas.module' -import { PublicDatasExportModule } from './modules/public-datas-export/public-datas-export.module' -import { SyncModule } from './modules/sync/sync.module' -import { ImportModule } from './modules/import/import.module' -import { CachesModule } from './modules/caches/caches.module' -import { TestModule } from './modules/test/test.module' -import { PluginsModule } from './modules/plugins/plugins.module' -import { GlobalModule } from './modules/global/global.module' -import { LocalStrategy } from './strategies/local.strategy' -import NcConfigFactory from './utils/NcConfigFactory' -import NcUpgrader from './version-upgrader/NcUpgrader' -import { ClientService } from './services/client/client.service' -import { AuthTokenStrategy } from './strategies/authtoken.strategy/authtoken.strategy' -import { BaseViewStrategy } from './strategies/base-view.strategy/base-view.strategy' -import { GoogleStrategy } from './strategies/google.strategy/google.strategy' +import { Module, RequestMethod } from '@nestjs/common'; +import { APP_FILTER, APP_GUARD } from '@nestjs/core'; +import { ExtractJwt } from 'passport-jwt'; +import { Connection } from './connection/connection'; +import { GlobalExceptionFilter } from './filters/global-exception/global-exception.filter'; +import { GlobalGuard } from './guards/global/global.guard'; +import { GlobalMiddleware } from './middlewares/global/global.middleware'; +import { AuthModule } from './modules/auth/auth.module'; +import { ExtractProjectIdMiddleware } from './middlewares/extract-project-id/extract-project-id.middleware'; +import { AuthService } from './modules/auth/auth.service'; +import { UsersModule } from './modules/users/users.module'; +import { MetaService } from './meta/meta.service'; +import { UsersService } from './modules/users/users.service'; +import { UtilsModule } from './modules/utils/utils.module'; +import { ProjectsModule } from './modules/projects/projects.module'; +import Noco from './Noco'; +import { JwtStrategy } from './strategies/jwt.strategy'; +import { TablesModule } from './modules/tables/tables.module'; +import { ViewsModule } from './modules/views/views.module'; +import { FiltersModule } from './modules/filters/filters.module'; +import { SortsModule } from './modules/sorts/sorts.module'; +import { ColumnsModule } from './modules/columns/columns.module'; +import { ViewColumnsModule } from './modules/view-columns/view-columns.module'; +import { BasesModule } from './modules/bases/bases.module'; +import { HooksModule } from './modules/hooks/hooks.module'; +import { SharedBasesModule } from './modules/shared-bases/shared-bases.module'; +import { FormsModule } from './modules/forms/forms.module'; +import { GridsModule } from './modules/grids/grids.module'; +import { KanbansModule } from './modules/kanbans/kanbans.module'; +import { GalleriesModule } from './modules/galleries/galleries.module'; +import { FormColumnsModule } from './modules/form-columns/form-columns.module'; +import { GridColumnsModule } from './modules/grid-columns/grid-columns.module'; +import { MapsModule } from './modules/maps/maps.module'; +import { ProjectUsersModule } from './modules/project-users/project-users.module'; +import { ModelVisibilitiesModule } from './modules/model-visibilities/model-visibilities.module'; +import { HookFiltersModule } from './modules/hook-filters/hook-filters.module'; +import { ApiTokensModule } from './modules/api-tokens/api-tokens.module'; +import { AttachmentsModule } from './modules/attachments/attachments.module'; +import { OrgLcenseModule } from './modules/org-lcense/org-lcense.module'; +import { OrgTokensModule } from './modules/org-tokens/org-tokens.module'; +import { OrgUsersModule } from './modules/org-users/org-users.module'; +import { MetaDiffsModule } from './modules/meta-diffs/meta-diffs.module'; +import { AuditsModule } from './modules/audits/audits.module'; +import { DatasModule } from './modules/datas/datas.module'; +import { ApiDocsModule } from './modules/api-docs/api-docs.module'; +import { PublicMetasModule } from './modules/public-metas/public-metas.module'; +import { PublicDatasModule } from './modules/public-datas/public-datas.module'; +import { PublicDatasExportModule } from './modules/public-datas-export/public-datas-export.module'; +import { SyncModule } from './modules/sync/sync.module'; +import { ImportModule } from './modules/import/import.module'; +import { CachesModule } from './modules/caches/caches.module'; +import { TestModule } from './modules/test/test.module'; +import { PluginsModule } from './modules/plugins/plugins.module'; +import { GlobalModule } from './modules/global/global.module'; +import { LocalStrategy } from './strategies/local.strategy'; +import NcConfigFactory from './utils/NcConfigFactory'; +import NcUpgrader from './version-upgrader/NcUpgrader'; +import { ClientService } from './services/client/client.service'; +import { AuthTokenStrategy } from './strategies/authtoken.strategy/authtoken.strategy'; +import { BaseViewStrategy } from './strategies/base-view.strategy/base-view.strategy'; +import { GoogleStrategy } from './strategies/google.strategy/google.strategy'; import type { MiddlewareConsumer, OnApplicationBootstrap, Provider, -} from '@nestjs/common' +} from '@nestjs/common'; /* @@ -156,25 +156,26 @@ export class AppModule implements OnApplicationBootstrap { constructor( private readonly connection: Connection, private readonly metaService: MetaService, - ) { - } + ) {} // Global Middleware configure(consumer: MiddlewareConsumer) { consumer .apply(GlobalMiddleware) - .forRoutes({ path: '*', method: RequestMethod.ALL }) + .forRoutes({ path: '*', method: RequestMethod.ALL }); } // app init async onApplicationBootstrap(): Promise { - await this.connection.init() - await this.metaService.init() + await this.connection.init(); + await this.metaService.init(); // todo: remove // temporary hack - Noco._ncMeta = this.metaService - Noco.config = this.connection.config + Noco._ncMeta = this.metaService; + Noco.config = this.connection.config; + + await Noco.loadEEState(); // run upgrader // await NcUpgrader.upgrade({ ncMeta: Noco._ncMeta }); diff --git a/packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts b/packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts index f3f683c405..7937090ecb 100644 --- a/packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts +++ b/packages/nocodb-nest/src/modules/org-lcense/org-lcense.controller.ts @@ -1,7 +1,14 @@ -import { Controller, Get, HttpCode, Post, UseGuards } from '@nestjs/common' +import { + Body, + Controller, + Get, + HttpCode, + Post, + UseGuards, +} from '@nestjs/common'; import { OrgUserRoles } from 'nocodb-sdk'; -import { GlobalGuard } from '../../guards/global/global.guard' -import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware' +import { GlobalGuard } from '../../guards/global/global.guard'; +import { Acl } from '../../middlewares/extract-project-id/extract-project-id.middleware'; import { OrgLcenseService } from './org-lcense.service'; @Controller() @@ -14,7 +21,7 @@ export class OrgLcenseController { allowedRoles: [OrgUserRoles.SUPER_ADMIN], blockApiTokenAccess: true, }) - async licenseGet(_req, res) { + async licenseGet() { return await this.orgLcenseService.licenseGet(); } @@ -24,8 +31,8 @@ export class OrgLcenseController { allowedRoles: [OrgUserRoles.SUPER_ADMIN], blockApiTokenAccess: true, }) - async licenseSet(req, res) { - await this.orgLcenseService.licenseSet({ key: req.body.key }); + async licenseSet(@Body() body) { + await this.orgLcenseService.licenseSet({ key: body.key }); return { msg: 'The license key has been saved' }; } } diff --git a/packages/nocodb-nest/src/modules/utils/utils.controller.ts b/packages/nocodb-nest/src/modules/utils/utils.controller.ts index 4577752a8e..bcdd24ce1a 100644 --- a/packages/nocodb-nest/src/modules/utils/utils.controller.ts +++ b/packages/nocodb-nest/src/modules/utils/utils.controller.ts @@ -6,7 +6,6 @@ import { Request, UseGuards, } from '@nestjs/common' -import { AuthGuard } from '@nestjs/passport'; import { GlobalGuard } from '../../guards/global/global.guard' import { Acl,