Browse Source

fix: corrections (WIP)

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
9c091cd576
  1. 26
      packages/nocodb-nest/src/modules/attachments/attachments.controller.ts
  2. 2
      packages/nocodb-nest/src/modules/hooks/hooks.controller.ts
  3. 2
      packages/nocodb-nest/src/modules/hooks/hooks.service.ts
  4. 2
      packages/nocodb-nest/src/modules/import/import.controller.ts
  5. 2
      packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts
  6. 3
      packages/nocodb-nest/src/modules/org-users/org-users.module.ts
  7. 3
      packages/nocodb-nest/src/modules/users/users.module.ts

26
packages/nocodb-nest/src/modules/attachments/attachments.controller.ts

@ -2,6 +2,7 @@ import {
Body, Body,
Controller, Controller,
Get, Get,
Param,
Post, Post,
Query, Query,
Request, Request,
@ -89,12 +90,15 @@ export class AttachmentsController {
return attachments; return attachments;
} }
@Get(/^\/download\/(.+)$/) // @Get(/^\/download\/(.+)$/)
// , getCacheMiddleware(), catchError(fileRead)); // , 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 { try {
const { img, type } = await this.attachmentsService.fileRead({ 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 }); 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(), // getCacheMiddleware(),
async fileReadv2(@Request() req, @Response() res) { async fileReadv2(
@Param('param1') param1: string,
@Param('param2') param2: string,
@Param('filename') filename: string,
@Response() res,
) {
try { try {
const { img, type } = await this.attachmentsService.fileRead({ const { img, type } = await this.attachmentsService.fileRead({
path: path.join( path: path.join(
'nc', 'nc',
req.params[0], param1,
req.params[1], param2,
'uploads', 'uploads',
...req.params[2].split('/'), ...filename.split('/'),
), ),
}); });

2
packages/nocodb-nest/src/modules/hooks/hooks.controller.ts

@ -83,7 +83,7 @@ export class HooksController {
async tableSampleData( async tableSampleData(
@Param('tableId') tableId: string, @Param('tableId') tableId: string,
@Param('operation') operation: HookType['operation'], @Param('operation') operation: HookType['operation'],
@Param('version') version: HookType['version'], @Param('version') version: any //HookType['version'],
) { ) {
return; return;
await this.hooksService.tableSampleData({ await this.hooksService.tableSampleData({

2
packages/nocodb-nest/src/modules/hooks/hooks.service.ts

@ -103,7 +103,7 @@ export class HooksService {
async tableSampleData(param: { async tableSampleData(param: {
tableId: string; tableId: string;
operation: HookType['operation']; operation: HookType['operation'];
version: HookType['version']; version: any// HookType['version'];
}) { }) {
const model = await Model.getByIdOrName({ id: param.tableId }); const model = await Model.getByIdOrName({ id: param.tableId });

2
packages/nocodb-nest/src/modules/import/import.controller.ts

@ -25,7 +25,7 @@ export default (
// add importer job handler and progress notification job handler // add importer job handler and progress notification job handler
NocoJobs.jobsMgr.addJobWorker( NocoJobs.jobsMgr.addJobWorker(
AIRTABLE_IMPORT_JOB, AIRTABLE_IMPORT_JOB,
this.syncService.airtableImportJob!, {} as any // this?.syncService?.airtableImportJob,
); );
NocoJobs.jobsMgr.addJobWorker( NocoJobs.jobsMgr.addJobWorker(
AIRTABLE_PROGRESS_JOB, AIRTABLE_PROGRESS_JOB,

2
packages/nocodb-nest/src/modules/org-tokens/org-tokens.module.ts

@ -5,6 +5,6 @@ import { OrgTokensController } from './org-tokens.controller';
@Module({ @Module({
controllers: [OrgTokensController], controllers: [OrgTokensController],
providers: [OrgTokensEeService] providers: [OrgTokensEeService, OrgTokensService]
}) })
export class OrgTokensModule {} export class OrgTokensModule {}

3
packages/nocodb-nest/src/modules/org-users/org-users.module.ts

@ -1,9 +1,10 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { ProjectUsersService } from '../project-users/project-users.service'
import { OrgUsersService } from './org-users.service'; import { OrgUsersService } from './org-users.service';
import { OrgUsersController } from './org-users.controller'; import { OrgUsersController } from './org-users.controller';
@Module({ @Module({
controllers: [OrgUsersController], controllers: [OrgUsersController],
providers: [OrgUsersService] providers: [OrgUsersService, ProjectUsersService]
}) })
export class OrgUsersModule {} export class OrgUsersModule {}

3
packages/nocodb-nest/src/modules/users/users.module.ts

@ -1,4 +1,5 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt'
import { Connection } from '../../connection/connection' import { Connection } from '../../connection/connection'
import { MetaService } from '../../meta/meta.service' import { MetaService } from '../../meta/meta.service'
import { UsersService } from './users.service'; import { UsersService } from './users.service';
@ -6,7 +7,7 @@ import { UsersController } from './users.controller';
@Module({ @Module({
controllers: [UsersController], controllers: [UsersController],
providers: [UsersService, MetaService, Connection], providers: [UsersService, MetaService, Connection, JwtService],
exports: [UsersService, Connection, MetaService], exports: [UsersService, Connection, MetaService],
}) })
export class UsersModule {} export class UsersModule {}

Loading…
Cancel
Save