diff --git a/packages/nocodb-nest/src/modules/attachments/attachments.controller.ts b/packages/nocodb-nest/src/modules/attachments/attachments.controller.ts index 7d333890ff..fb9d027253 100644 --- a/packages/nocodb-nest/src/modules/attachments/attachments.controller.ts +++ b/packages/nocodb-nest/src/modules/attachments/attachments.controller.ts @@ -2,6 +2,7 @@ import { Body, Controller, Get, + Param, Post, Query, Request, @@ -89,12 +90,15 @@ export class AttachmentsController { return attachments; } - @Get(/^\/download\/(.+)$/) + // @Get(/^\/download\/(.+)$/) // , getCacheMiddleware(), catchError(fileRead)); - async fileRead(req, res) { + @Get('/download/:filename(*)') + // This route will match any URL that starts with + async fileRead(@Param('filename') filename: string + , @Response() res) { try { const { img, type } = await this.attachmentsService.fileRead({ - path: path.join('nc', 'uploads', req.params?.[0]), + path: path.join('nc', 'uploads', filename), }); res.writeHead(200, { 'Content-Type': type }); @@ -105,17 +109,23 @@ export class AttachmentsController { } } - @Get(/^\/dl\/([^/]+)\/([^/]+)\/(.+)$/) + // @Get(/^\/dl\/([^/]+)\/([^/]+)\/(.+)$/) + @Get('/dl/:param1([a-zA-Z0-9_-]+)/:param2([a-zA-Z0-9_-]+)/:filename(*)') // getCacheMiddleware(), - async fileReadv2(@Request() req, @Response() res) { + async fileReadv2( + @Param('param1') param1: string, + @Param('param2') param2: string, + @Param('filename') filename: string, + @Response() res, + ) { try { const { img, type } = await this.attachmentsService.fileRead({ path: path.join( 'nc', - req.params[0], - req.params[1], + param1, + param2, 'uploads', - ...req.params[2].split('/'), + ...filename.split('/'), ), }); diff --git a/packages/nocodb-nest/src/modules/hooks/hooks.controller.ts b/packages/nocodb-nest/src/modules/hooks/hooks.controller.ts index c787f3d49d..498f12f15e 100644 --- a/packages/nocodb-nest/src/modules/hooks/hooks.controller.ts +++ b/packages/nocodb-nest/src/modules/hooks/hooks.controller.ts @@ -83,7 +83,7 @@ export class HooksController { async tableSampleData( @Param('tableId') tableId: string, @Param('operation') operation: HookType['operation'], - @Param('version') version: HookType['version'], + @Param('version') version: any //HookType['version'], ) { return; await this.hooksService.tableSampleData({ diff --git a/packages/nocodb-nest/src/modules/hooks/hooks.service.ts b/packages/nocodb-nest/src/modules/hooks/hooks.service.ts index 1916b8cb5f..91aee68a9c 100644 --- a/packages/nocodb-nest/src/modules/hooks/hooks.service.ts +++ b/packages/nocodb-nest/src/modules/hooks/hooks.service.ts @@ -103,7 +103,7 @@ export class HooksService { async tableSampleData(param: { tableId: string; operation: HookType['operation']; - version: HookType['version']; + version: any// HookType['version']; }) { const model = await Model.getByIdOrName({ id: param.tableId }); diff --git a/packages/nocodb-nest/src/modules/import/import.controller.ts b/packages/nocodb-nest/src/modules/import/import.controller.ts index 7851ee4c15..63eb4ec767 100644 --- a/packages/nocodb-nest/src/modules/import/import.controller.ts +++ b/packages/nocodb-nest/src/modules/import/import.controller.ts @@ -25,7 +25,7 @@ export default ( // add importer job handler and progress notification job handler NocoJobs.jobsMgr.addJobWorker( AIRTABLE_IMPORT_JOB, - this.syncService.airtableImportJob!, + {} as any // this?.syncService?.airtableImportJob, ); NocoJobs.jobsMgr.addJobWorker( AIRTABLE_PROGRESS_JOB, diff --git a/packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts b/packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts index fffb13410a..a2c8f5dda2 100644 --- a/packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts +++ b/packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts @@ -5,6 +5,6 @@ import { OrgTokensController } from './org-tokens.controller'; @Module({ controllers: [OrgTokensController], - providers: [OrgTokensEeService] + providers: [OrgTokensEeService, OrgTokensService] }) export class OrgTokensModule {} diff --git a/packages/nocodb-nest/src/modules/org-users/org-users.module.ts b/packages/nocodb-nest/src/modules/org-users/org-users.module.ts index afee64421b..af06a80c7f 100644 --- a/packages/nocodb-nest/src/modules/org-users/org-users.module.ts +++ b/packages/nocodb-nest/src/modules/org-users/org-users.module.ts @@ -1,9 +1,10 @@ import { Module } from '@nestjs/common'; +import { ProjectUsersService } from '../project-users/project-users.service' import { OrgUsersService } from './org-users.service'; import { OrgUsersController } from './org-users.controller'; @Module({ controllers: [OrgUsersController], - providers: [OrgUsersService] + providers: [OrgUsersService, ProjectUsersService] }) export class OrgUsersModule {} diff --git a/packages/nocodb-nest/src/modules/users/users.module.ts b/packages/nocodb-nest/src/modules/users/users.module.ts index c4e20f35cf..3526ab0b3a 100644 --- a/packages/nocodb-nest/src/modules/users/users.module.ts +++ b/packages/nocodb-nest/src/modules/users/users.module.ts @@ -1,4 +1,5 @@ import { Module } from '@nestjs/common'; +import { JwtService } from '@nestjs/jwt' import { Connection } from '../../connection/connection' import { MetaService } from '../../meta/meta.service' import { UsersService } from './users.service'; @@ -6,7 +7,7 @@ import { UsersController } from './users.controller'; @Module({ controllers: [UsersController], - providers: [UsersService, MetaService, Connection], + providers: [UsersService, MetaService, Connection, JwtService], exports: [UsersService, Connection, MetaService], }) export class UsersModule {}