Skip to content

Commit

Permalink
fix multer type, restore auth to import
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 6, 2024
1 parent 484ceca commit 78e46ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
11 changes: 3 additions & 8 deletions api/src/modules/import/import.controller.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
Controller,
Post,
UploadedFile,
UseInterceptors,
} from '@nestjs/common';
import { Controller, Post, UseInterceptors } from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { JwtAuthGuard } from '@api/modules/auth/guards/jwt-auth.guard';
import { RolesGuard } from '@api/modules/auth/guards/roles.guard';
Expand All @@ -13,14 +8,14 @@ import { UploadXlsm } from '@api/modules/import/decorators/xlsm-upload.decorator
import { ImportService } from '@api/modules/import/import.service';

@Controller()
//@UseInterceptors(JwtAuthGuard, RolesGuard)
@UseInterceptors(JwtAuthGuard, RolesGuard)
export class ImportController {
constructor(private readonly service: ImportService) {}
// TODO: File validation following:
// https://docs.nestjs.com/techniques/file-upload

@Post('/admin/upload/xlsx')
//@RequiredRoles(ROLES.ADMIN)
@RequiredRoles(ROLES.ADMIN)
@UseInterceptors(FileInterceptor('file'))
async uploadFile(@UploadXlsm() file: Express.Multer.File): Promise<any> {
return this.service.import(file);
Expand Down
4 changes: 0 additions & 4 deletions api/src/modules/import/services/excel-parser.interface.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
export const ExcelParserToken = Symbol('ExcelParserInterface');
import exel_to_entity_map from '@shared/excel_to_entity_map.json';

export const SHEETS_TO_PARSE = ['master_table', 'Countries'];

export type ExcelType = typeof exel_to_entity_map;

export interface ExcelParserInterface {
parseExcel(data: Buffer): Promise<any>;
}

0 comments on commit 78e46ea

Please sign in to comment.