Browse Source

refactor: merge core modules into single noco module

pull/8542/head
mertmit 6 months ago
parent
commit
e580c9cbd9
  1. 12
      packages/nocodb/src/app.module.ts
  2. 2
      packages/nocodb/src/controllers/data-alias-export.controller.ts
  3. 2
      packages/nocodb/src/controllers/old-datas/old-datas.service.ts
  4. 2
      packages/nocodb/src/controllers/public-datas-export.controller.ts
  5. 0
      packages/nocodb/src/helpers/dataHelpers.ts
  6. 16
      packages/nocodb/src/modules/auth/auth.module.ts
  7. 71
      packages/nocodb/src/modules/datas/datas.module.ts
  8. 67
      packages/nocodb/src/modules/global/global.module.ts
  9. 8
      packages/nocodb/src/modules/jobs/jobs.module.ts
  10. 2
      packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts
  11. 121
      packages/nocodb/src/modules/noco.module.ts
  12. 15
      packages/nocodb/src/modules/users/users.module.ts
  13. 0
      packages/nocodb/src/providers/init-meta-service.provider.ts
  14. 27
      packages/nocodb/src/providers/jwt-strategy.provider.ts
  15. 4
      packages/nocodb/src/services/base-users/base-users.service.ts
  16. 4
      packages/nocodb/src/services/bulk-data-alias.service.ts
  17. 4
      packages/nocodb/src/services/data-alias-nested.service.ts
  18. 4
      packages/nocodb/src/services/datas.service.ts
  19. 2
      packages/nocodb/src/services/public-datas.service.ts

12
packages/nocodb/src/app.module.ts

@ -5,34 +5,26 @@ import { ConfigModule } from '@nestjs/config';
import { EventEmitterModule as NestJsEventEmitter } from '@nestjs/event-emitter'; import { EventEmitterModule as NestJsEventEmitter } from '@nestjs/event-emitter';
import { SentryModule } from '@ntegral/nestjs-sentry'; import { SentryModule } from '@ntegral/nestjs-sentry';
import type { MiddlewareConsumer } from '@nestjs/common'; import type { MiddlewareConsumer } from '@nestjs/common';
import { NocoModule } from '~/modules/noco.module';
import { GlobalExceptionFilter } from '~/filters/global-exception/global-exception.filter'; import { GlobalExceptionFilter } from '~/filters/global-exception/global-exception.filter';
import { GlobalMiddleware } from '~/middlewares/global/global.middleware'; import { GlobalMiddleware } from '~/middlewares/global/global.middleware';
import { GuiMiddleware } from '~/middlewares/gui/gui.middleware'; import { GuiMiddleware } from '~/middlewares/gui/gui.middleware';
import { DatasModule } from '~/modules/datas/datas.module';
import { EventEmitterModule } from '~/modules/event-emitter/event-emitter.module'; import { EventEmitterModule } from '~/modules/event-emitter/event-emitter.module';
import { AuthService } from '~/services/auth.service'; import { AuthService } from '~/services/auth.service';
import { GlobalModule } from '~/modules/global/global.module';
import { LocalStrategy } from '~/strategies/local.strategy'; import { LocalStrategy } from '~/strategies/local.strategy';
import { AuthTokenStrategy } from '~/strategies/authtoken.strategy/authtoken.strategy'; import { AuthTokenStrategy } from '~/strategies/authtoken.strategy/authtoken.strategy';
import { BaseViewStrategy } from '~/strategies/base-view.strategy/base-view.strategy'; import { BaseViewStrategy } from '~/strategies/base-view.strategy/base-view.strategy';
import { MetasModule } from '~/modules/metas/metas.module';
import { JobsModule } from '~/modules/jobs/jobs.module'; import { JobsModule } from '~/modules/jobs/jobs.module';
import appConfig from '~/app.config'; import appConfig from '~/app.config';
import { ExtractIdsMiddleware } from '~/middlewares/extract-ids/extract-ids.middleware'; import { ExtractIdsMiddleware } from '~/middlewares/extract-ids/extract-ids.middleware';
import { BasicStrategy } from '~/strategies/basic.strategy/basic.strategy'; import { BasicStrategy } from '~/strategies/basic.strategy/basic.strategy';
import { UsersModule } from '~/modules/users/users.module';
import { AuthModule } from '~/modules/auth/auth.module';
import { packageInfo } from '~/utils/packageVersion'; import { packageInfo } from '~/utils/packageVersion';
export const ceModuleConfig = { export const ceModuleConfig = {
imports: [ imports: [
GlobalModule, NocoModule,
UsersModule,
AuthModule,
MetasModule,
DatasModule,
EventEmitterModule, EventEmitterModule,
JobsModule, JobsModule,
NestJsEventEmitter.forRoot(), NestJsEventEmitter.forRoot(),

2
packages/nocodb/src/controllers/data-alias-export.controller.ts

@ -3,7 +3,7 @@ import { Request, Response } from 'express';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { GlobalGuard } from '~/guards/global/global.guard'; import { GlobalGuard } from '~/guards/global/global.guard';
import { DatasService } from '~/services/datas.service'; import { DatasService } from '~/services/datas.service';
import { extractCsvData, extractXlsxData } from '~/modules/datas/helpers'; import { extractCsvData, extractXlsxData } from '~/helpers/dataHelpers';
import { View } from '~/models'; import { View } from '~/models';
import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware'; import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware';
import { DataApiLimiterGuard } from '~/guards/data-api-limiter.guard'; import { DataApiLimiterGuard } from '~/guards/data-api-limiter.guard';

2
packages/nocodb/src/controllers/old-datas/old-datas.service.ts

@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { nocoExecute } from 'nc-help'; import { nocoExecute } from 'nc-help';
import type { OldPathParams } from '~/modules/datas/helpers'; import type { OldPathParams } from '~/helpers/dataHelpers';
import getAst from '~/helpers/getAst'; import getAst from '~/helpers/getAst';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { Base, Model, Source, View } from '~/models'; import { Base, Model, Source, View } from '~/models';

2
packages/nocodb/src/controllers/public-datas-export.controller.ts

@ -12,7 +12,7 @@ import { nocoExecute } from 'nc-help';
import papaparse from 'papaparse'; import papaparse from 'papaparse';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import getAst from '~/helpers/getAst'; import getAst from '~/helpers/getAst';
import { serializeCellValue } from '~/modules/datas/helpers'; import { serializeCellValue } from '~/helpers/dataHelpers';
import { PublicDatasExportService } from '~/services/public-datas-export.service'; import { PublicDatasExportService } from '~/services/public-datas-export.service';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { Column, Model, Source, View } from '~/models'; import { Column, Model, Source, View } from '~/models';

0
packages/nocodb/src/modules/datas/helpers.ts → packages/nocodb/src/helpers/dataHelpers.ts

16
packages/nocodb/src/modules/auth/auth.module.ts

@ -1,16 +0,0 @@
import { forwardRef, Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { GoogleStrategyProvider } from '~/strategies/google.strategy/google.strategy';
import { UsersService } from '~/services/users/users.service';
import { AuthController } from '~/controllers/auth/auth.controller';
import { MetasModule } from '~/modules/metas/metas.module';
@Module({
imports: [PassportModule, forwardRef(() => MetasModule)],
controllers: [
...(process.env.NC_WORKER_CONTAINER !== 'true' ? [AuthController] : []),
],
providers: [UsersService, GoogleStrategyProvider],
exports: [UsersService],
})
export class AuthModule {}

71
packages/nocodb/src/modules/datas/datas.module.ts

@ -1,71 +0,0 @@
import { Module } from '@nestjs/common';
import { MulterModule } from '@nestjs/platform-express';
import multer from 'multer';
import { NC_ATTACHMENT_FIELD_SIZE } from '~/constants';
import { DataTableController } from '~/controllers/data-table.controller';
import { DataTableService } from '~/services/data-table.service';
import { DataAliasController } from '~/controllers/data-alias.controller';
import { PublicDatasExportController } from '~/controllers/public-datas-export.controller';
import { PublicDatasController } from '~/controllers/public-datas.controller';
import { DatasService } from '~/services/datas.service';
import { DatasController } from '~/controllers/datas.controller';
import { BulkDataAliasController } from '~/controllers/bulk-data-alias.controller';
import { DataAliasExportController } from '~/controllers/data-alias-export.controller';
import { DataAliasNestedController } from '~/controllers/data-alias-nested.controller';
import { OldDatasController } from '~/controllers/old-datas/old-datas.controller';
import { BulkDataAliasService } from '~/services/bulk-data-alias.service';
import { DataAliasNestedService } from '~/services/data-alias-nested.service';
import { OldDatasService } from '~/controllers/old-datas/old-datas.service';
import { PublicDatasExportService } from '~/services/public-datas-export.service';
import { PublicDatasService } from '~/services/public-datas.service';
import { CalendarDatasController } from '~/controllers/calendars-datas.controller';
import { CalendarDatasService } from '~/services/calendar-datas.service';
export const dataModuleMetadata = {
imports: [
MulterModule.register({
storage: multer.diskStorage({}),
limits: {
fieldSize: NC_ATTACHMENT_FIELD_SIZE,
},
}),
],
controllers: [
...(process.env.NC_WORKER_CONTAINER !== 'true'
? [
DataTableController,
DatasController,
CalendarDatasController,
BulkDataAliasController,
DataAliasController,
DataAliasNestedController,
DataAliasExportController,
OldDatasController,
PublicDatasController,
PublicDatasExportController,
]
: []),
],
providers: [
DataTableService,
DatasService,
BulkDataAliasService,
DataAliasNestedService,
CalendarDatasService,
OldDatasService,
PublicDatasService,
PublicDatasExportService,
],
exports: [
DatasService,
BulkDataAliasService,
CalendarDatasService,
DataAliasNestedService,
OldDatasService,
PublicDatasService,
PublicDatasExportService,
],
};
@Module(dataModuleMetadata)
export class DatasModule {}

67
packages/nocodb/src/modules/global/global.module.ts

@ -1,67 +0,0 @@
import { forwardRef, Global, Module } from '@nestjs/common';
import { ExtractJwt } from 'passport-jwt';
import type { Provider } from '@nestjs/common';
import { InitMetaServiceProvider } from '~/modules/global/init-meta-service.provider';
import { EventEmitterModule } from '~/modules/event-emitter/event-emitter.module';
import { SocketGateway } from '~/gateways/socket.gateway';
import { GlobalGuard } from '~/guards/global/global.guard';
import { MetaService } from '~/meta/meta.service';
import Noco from '~/Noco';
import { AppHooksService } from '~/services/app-hooks/app-hooks.service';
import { JwtStrategy } from '~/strategies/jwt.strategy';
import { UsersService } from '~/services/users/users.service';
import { TelemetryService } from '~/services/telemetry.service';
import { AppHooksListenerService } from '~/services/app-hooks-listener.service';
import { HookHandlerService } from '~/services/hook-handler.service';
import { UsersModule } from '~/modules/users/users.module';
import { JobsModule } from '~/modules/jobs/jobs.module';
export const JwtStrategyProvider: Provider = {
provide: JwtStrategy,
useFactory: async (usersService: UsersService, metaService: MetaService) => {
const config = metaService.config;
await Noco.initJwt();
const options = {
// ignoreExpiration: false,
jwtFromRequest: ExtractJwt.fromHeader('xc-auth'),
// expiresIn: '10h',
passReqToCallback: true,
secretOrKey: config.auth.jwt.secret,
...config.auth.jwt.options,
};
return new JwtStrategy(options, usersService);
},
inject: [UsersService, MetaService],
};
export const globalModuleMetadata = {
imports: [EventEmitterModule, forwardRef(() => UsersModule), JobsModule],
providers: [
InitMetaServiceProvider,
AppHooksService,
JwtStrategyProvider,
GlobalGuard,
SocketGateway,
AppHooksService,
AppHooksListenerService,
TelemetryService,
HookHandlerService,
],
exports: [
MetaService,
JwtStrategyProvider,
GlobalGuard,
AppHooksService,
AppHooksListenerService,
TelemetryService,
HookHandlerService,
...(process.env.NC_WORKER_CONTAINER !== 'true' ? [SocketGateway] : []),
],
};
@Global()
@Module(globalModuleMetadata)
export class GlobalModule {}

8
packages/nocodb/src/modules/jobs/jobs.module.ts

@ -1,5 +1,6 @@
import { Module } from '@nestjs/common'; import { forwardRef, Module } from '@nestjs/common';
import { BullModule } from '@nestjs/bull'; import { BullModule } from '@nestjs/bull';
import { NocoModule } from '~/modules/noco.module';
// Jobs // Jobs
import { ExportService } from '~/modules/jobs/jobs/export-import/export.service'; import { ExportService } from '~/modules/jobs/jobs/export-import/export.service';
@ -29,13 +30,10 @@ import { JobsService as FallbackJobsService } from '~/modules/jobs/fallback/jobs
import { QueueService as FallbackQueueService } from '~/modules/jobs/fallback/fallback-queue.service'; import { QueueService as FallbackQueueService } from '~/modules/jobs/fallback/fallback-queue.service';
import { JobsEventService as FallbackJobsEventService } from '~/modules/jobs/fallback/jobs-event.service'; import { JobsEventService as FallbackJobsEventService } from '~/modules/jobs/fallback/jobs-event.service';
import { JOBS_QUEUE } from '~/interface/Jobs'; import { JOBS_QUEUE } from '~/interface/Jobs';
import { MetasModule } from '~/modules/metas/metas.module';
import { DatasModule } from '~/modules/datas/datas.module';
export const JobsModuleMetadata = { export const JobsModuleMetadata = {
imports: [ imports: [
DatasModule, forwardRef(() => NocoModule),
MetasModule,
...(process.env.NC_REDIS_JOB_URL ...(process.env.NC_REDIS_JOB_URL
? [ ? [
BullModule.forRoot({ BullModule.forRoot({

2
packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts

@ -8,7 +8,7 @@ import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import type { View } from '~/models'; import type { View } from '~/models';
import { Base, Hook, Model, Source } from '~/models'; import { Base, Hook, Model, Source } from '~/models';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { getViewAndModelByAliasOrId } from '~/modules/datas/helpers'; import { getViewAndModelByAliasOrId } from '~/helpers/dataHelpers';
import { clearPrefix, generateBaseIdMap } from '~/helpers/exportImportHelpers'; import { clearPrefix, generateBaseIdMap } from '~/helpers/exportImportHelpers';
import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2'; import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';

121
packages/nocodb/src/modules/metas/metas.module.ts → packages/nocodb/src/modules/noco.module.ts

@ -1,6 +1,28 @@
import multer from 'multer';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { MulterModule } from '@nestjs/platform-express'; import { MulterModule } from '@nestjs/platform-express';
import multer from 'multer';
/* Modules */
import { EventEmitterModule } from '~/modules/event-emitter/event-emitter.module';
import { JobsModule } from '~/modules/jobs/jobs.module';
/* Generic */
import { InitMetaServiceProvider } from '~/providers/init-meta-service.provider';
import { JwtStrategyProvider } from '~/providers/jwt-strategy.provider';
import { JwtStrategy } from '~/strategies/jwt.strategy';
import { SocketGateway } from '~/gateways/socket.gateway';
import { GlobalGuard } from '~/guards/global/global.guard';
import { AppHooksService } from '~/services/app-hooks/app-hooks.service';
import { TelemetryService } from '~/services/telemetry.service';
import { AppHooksListenerService } from '~/services/app-hooks-listener.service';
import { HookHandlerService } from '~/services/hook-handler.service';
/* User */
import { UsersController } from '~/controllers/users/users.controller';
import { UsersService } from '~/services/users/users.service';
/* Metas */
import { NC_ATTACHMENT_FIELD_SIZE } from '~/constants'; import { NC_ATTACHMENT_FIELD_SIZE } from '~/constants';
import { ApiDocsController } from '~/controllers/api-docs/api-docs.controller'; import { ApiDocsController } from '~/controllers/api-docs/api-docs.controller';
import { ApiTokensController } from '~/controllers/api-tokens.controller'; import { ApiTokensController } from '~/controllers/api-tokens.controller';
@ -39,7 +61,6 @@ import { ApiTokensService } from '~/services/api-tokens.service';
import { AttachmentsService } from '~/services/attachments.service'; import { AttachmentsService } from '~/services/attachments.service';
import { AuditsService } from '~/services/audits.service'; import { AuditsService } from '~/services/audits.service';
import { SourcesService } from '~/services/sources.service'; import { SourcesService } from '~/services/sources.service';
import { BulkDataAliasService } from '~/services/bulk-data-alias.service';
import { CachesService } from '~/services/caches.service'; import { CachesService } from '~/services/caches.service';
import { CalendarsService } from '~/services/calendars.service'; import { CalendarsService } from '~/services/calendars.service';
import { ColumnsService } from '~/services/columns.service'; import { ColumnsService } from '~/services/columns.service';
@ -79,8 +100,35 @@ import { CommandPaletteController } from '~/controllers/command-palette.controll
import { ExtensionsService } from '~/services/extensions.service'; import { ExtensionsService } from '~/services/extensions.service';
import { ExtensionsController } from '~/controllers/extensions.controller'; import { ExtensionsController } from '~/controllers/extensions.controller';
export const metaModuleMetadata = { /* Datas */
import { DataTableController } from '~/controllers/data-table.controller';
import { DataTableService } from '~/services/data-table.service';
import { DataAliasController } from '~/controllers/data-alias.controller';
import { PublicDatasExportController } from '~/controllers/public-datas-export.controller';
import { PublicDatasController } from '~/controllers/public-datas.controller';
import { DatasService } from '~/services/datas.service';
import { DatasController } from '~/controllers/datas.controller';
import { BulkDataAliasController } from '~/controllers/bulk-data-alias.controller';
import { DataAliasExportController } from '~/controllers/data-alias-export.controller';
import { DataAliasNestedController } from '~/controllers/data-alias-nested.controller';
import { OldDatasController } from '~/controllers/old-datas/old-datas.controller';
import { BulkDataAliasService } from '~/services/bulk-data-alias.service';
import { DataAliasNestedService } from '~/services/data-alias-nested.service';
import { OldDatasService } from '~/controllers/old-datas/old-datas.service';
import { PublicDatasExportService } from '~/services/public-datas-export.service';
import { PublicDatasService } from '~/services/public-datas.service';
import { CalendarDatasController } from '~/controllers/calendars-datas.controller';
import { CalendarDatasService } from '~/services/calendar-datas.service';
/* Auth */
import { GoogleStrategyProvider } from '~/strategies/google.strategy/google.strategy';
import { AuthController } from '~/controllers/auth/auth.controller';
export const nocoModuleMetadata = {
imports: [ imports: [
EventEmitterModule,
JobsModule,
PassportModule,
MulterModule.register({ MulterModule.register({
storage: multer.diskStorage({}), storage: multer.diskStorage({}),
limits: { limits: {
@ -91,6 +139,10 @@ export const metaModuleMetadata = {
controllers: [ controllers: [
...(process.env.NC_WORKER_CONTAINER !== 'true' ...(process.env.NC_WORKER_CONTAINER !== 'true'
? [ ? [
/* Users */
UsersController,
/* Metas */
ApiDocsController, ApiDocsController,
ApiTokensController, ApiTokensController,
...(process.env.NC_SECURE_ATTACHMENTS === 'true' ...(process.env.NC_SECURE_ATTACHMENTS === 'true'
@ -129,11 +181,40 @@ export const metaModuleMetadata = {
NotificationsController, NotificationsController,
CommandPaletteController, CommandPaletteController,
ExtensionsController, ExtensionsController,
/* Datas */
DataTableController,
DatasController,
CalendarDatasController,
BulkDataAliasController,
DataAliasController,
DataAliasNestedController,
DataAliasExportController,
OldDatasController,
PublicDatasController,
PublicDatasExportController,
/* Auth */
AuthController,
] ]
: []), : []),
], ],
providers: [ providers: [
/** Services */ /* Generic */
InitMetaServiceProvider,
AppHooksService,
JwtStrategyProvider,
GlobalGuard,
SocketGateway,
AppHooksService,
AppHooksListenerService,
TelemetryService,
HookHandlerService,
/* Users */
UsersService,
/* Metas */
ApiDocsService, ApiDocsService,
ApiTokensService, ApiTokensService,
AttachmentsService, AttachmentsService,
@ -168,13 +249,34 @@ export const metaModuleMetadata = {
SyncService, SyncService,
SortsService, SortsService,
SharedBasesService, SharedBasesService,
BulkDataAliasService,
NotificationsService, NotificationsService,
NotificationsGateway, NotificationsGateway,
CommandPaletteService, CommandPaletteService,
ExtensionsService, ExtensionsService,
/* Datas */
DataTableService,
DatasService,
BulkDataAliasService,
DataAliasNestedService,
CalendarDatasService,
OldDatasService,
PublicDatasService,
PublicDatasExportService,
/* Auth */
GoogleStrategyProvider,
], ],
exports: [ exports: [
/* Generic */
TelemetryService,
HookHandlerService,
JwtStrategy,
/* Users */
UsersService,
/* Metas */
TablesService, TablesService,
ColumnsService, ColumnsService,
FiltersService, FiltersService,
@ -193,11 +295,14 @@ export const metaModuleMetadata = {
BaseUsersService, BaseUsersService,
HooksService, HooksService,
MetaDiffsService, MetaDiffsService,
BasesService,
SourcesService, SourcesService,
UtilsService, UtilsService,
/* Datas */
DatasService,
BulkDataAliasService,
], ],
}; };
@Module(metaModuleMetadata) @Module(nocoModuleMetadata)
export class MetasModule {} export class NocoModule {}

15
packages/nocodb/src/modules/users/users.module.ts

@ -1,15 +0,0 @@
import { forwardRef, Module } from '@nestjs/common';
import { PassportModule } from '@nestjs/passport';
import { UsersService } from '~/services/users/users.service';
import { UsersController } from '~/controllers/users/users.controller';
import { MetasModule } from '~/modules/metas/metas.module';
@Module({
imports: [PassportModule, forwardRef(() => MetasModule)],
controllers: [
...(process.env.NC_WORKER_CONTAINER !== 'true' ? [UsersController] : []),
],
providers: [UsersService],
exports: [UsersService],
})
export class UsersModule {}

0
packages/nocodb/src/modules/global/init-meta-service.provider.ts → packages/nocodb/src/providers/init-meta-service.provider.ts

27
packages/nocodb/src/providers/jwt-strategy.provider.ts

@ -0,0 +1,27 @@
import { ExtractJwt } from 'passport-jwt';
import type { Provider } from '@nestjs/common';
import { MetaService } from '~/meta/meta.service';
import { UsersService } from '~/services/users/users.service';
import { JwtStrategy } from '~/strategies/jwt.strategy';
import Noco from '~/Noco';
export const JwtStrategyProvider: Provider = {
provide: JwtStrategy,
useFactory: async (usersService: UsersService, metaService: MetaService) => {
const config = metaService.config;
await Noco.initJwt();
const options = {
// ignoreExpiration: false,
jwtFromRequest: ExtractJwt.fromHeader('xc-auth'),
// expiresIn: '10h',
passReqToCallback: true,
secretOrKey: config.auth.jwt.secret,
...config.auth.jwt.options,
};
return new JwtStrategy(options, usersService);
},
inject: [UsersService, MetaService],
};

4
packages/nocodb/src/services/base-users/base-users.service.ts

@ -350,7 +350,9 @@ export class BaseUsersService {
// todo: refactor the whole function // todo: refactor the whole function
async sendInviteEmail(email: string, token: string, req: any): Promise<any> { async sendInviteEmail(email: string, token: string, req: any): Promise<any> {
try { try {
const template = (await import('./ui/emailTemplates/invite')).default; const template = (
await import('~/services/base-users/ui/emailTemplates/invite')
).default;
const emailAdapter = await NcPluginMgrv2.emailAdapter(); const emailAdapter = await NcPluginMgrv2.emailAdapter();

4
packages/nocodb/src/services/bulk-data-alias.service.ts

@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import type { PathParams } from '~/modules/datas/helpers'; import type { PathParams } from '~/helpers/dataHelpers';
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import { getViewAndModelByAliasOrId } from '~/modules/datas/helpers'; import { getViewAndModelByAliasOrId } from '~/helpers/dataHelpers';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { Model, Source } from '~/models'; import { Model, Source } from '~/models';

4
packages/nocodb/src/services/data-alias-nested.service.ts

@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { UITypes } from 'nocodb-sdk'; import { UITypes } from 'nocodb-sdk';
import type { PathParams } from '~/modules/datas/helpers'; import type { PathParams } from '~/helpers/dataHelpers';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
import { PagedResponseImpl } from '~/helpers/PagedResponse'; import { PagedResponseImpl } from '~/helpers/PagedResponse';
import { import {
getColumnByIdOrName, getColumnByIdOrName,
getViewAndModelByAliasOrId, getViewAndModelByAliasOrId,
} from '~/modules/datas/helpers'; } from '~/helpers/dataHelpers';
import { Model, Source } from '~/models'; import { Model, Source } from '~/models';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';

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

@ -4,8 +4,8 @@ import * as XLSX from 'xlsx';
import papaparse from 'papaparse'; import papaparse from 'papaparse';
import { nocoExecute } from 'nc-help'; import { nocoExecute } from 'nc-help';
import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import type { PathParams } from '~/modules/datas/helpers'; import type { PathParams } from '~/helpers/dataHelpers';
import { getDbRows, getViewAndModelByAliasOrId } from '~/modules/datas/helpers'; import { getDbRows, getViewAndModelByAliasOrId } from '~/helpers/dataHelpers';
import { Base, Column, Model, Source, View } from '~/models'; import { Base, Column, Model, Source, View } from '~/models';
import { NcBaseError, NcError } from '~/helpers/catchError'; import { NcBaseError, NcError } from '~/helpers/catchError';
import getAst from '~/helpers/getAst'; import getAst from '~/helpers/getAst';

2
packages/nocodb/src/services/public-datas.service.ts

@ -11,7 +11,7 @@ import { NcError } from '~/helpers/catchError';
import getAst from '~/helpers/getAst'; import getAst from '~/helpers/getAst';
import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2'; import NcPluginMgrv2 from '~/helpers/NcPluginMgrv2';
import { PagedResponseImpl } from '~/helpers/PagedResponse'; import { PagedResponseImpl } from '~/helpers/PagedResponse';
import { getColumnByIdOrName } from '~/modules/datas/helpers'; import { getColumnByIdOrName } from '~/helpers/dataHelpers';
import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2'; import NcConnectionMgrv2 from '~/utils/common/NcConnectionMgrv2';
import { mimeIcons } from '~/utils/mimeTypes'; import { mimeIcons } from '~/utils/mimeTypes';
import { utf8ify } from '~/helpers/stringHelpers'; import { utf8ify } from '~/helpers/stringHelpers';

Loading…
Cancel
Save