-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
29 changed files
with
286 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { SignedUrlDto } from './signed-url.dto'; | ||
export { ValidRequestDto } from './valid.dto'; | ||
export { SheetNamesDto } from './sheet-names.dto'; | ||
export { ImportConfigResponseDto } from './import-config-response.dto'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class SheetNamesDto { | ||
@ApiProperty({ | ||
type: 'file', | ||
required: true, | ||
}) | ||
file: Express.Multer.File; | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/api/src/app/common/usecases/get-sheet-names/get-sheet-names.command.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { IsDefined } from 'class-validator'; | ||
import { BaseCommand } from '@shared/commands/base.command'; | ||
|
||
export class GetSheetNamesCommand extends BaseCommand { | ||
@IsDefined() | ||
file: Express.Multer.File; | ||
} |
25 changes: 25 additions & 0 deletions
25
apps/api/src/app/common/usecases/get-sheet-names/get-sheet-names.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { FileMimeTypesEnum } from '@impler/shared'; | ||
|
||
import { CONSTANTS } from '@shared/constants'; | ||
import { ExcelFileService } from '@shared/services/file'; | ||
import { GetSheetNamesCommand } from './get-sheet-names.command'; | ||
import { FileParseException } from '@shared/exceptions/file-parse-issue.exception'; | ||
|
||
@Injectable() | ||
export class GetSheetNames { | ||
async execute({ file }: GetSheetNamesCommand): Promise<string[]> { | ||
if (file.mimetype === FileMimeTypesEnum.EXCEL || file.mimetype === FileMimeTypesEnum.EXCELX) { | ||
try { | ||
const fileService = new ExcelFileService(); | ||
const sheetNames = await fileService.getExcelSheets(file); | ||
|
||
return sheetNames.filter((sheetName) => !sheetName.startsWith(CONSTANTS.EXCEL_DATA_SHEET_STARTER)); | ||
} catch (error) { | ||
throw new FileParseException(); | ||
} | ||
} else { | ||
throw new Error('Invalid file type'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { GetImportConfig } from './get-import-config/get-import-config.usecase'; | ||
import { ValidRequest } from './valid-request/valid-request.usecase'; | ||
import { GetSignedUrl } from './get-signed-url/get-signed-url.usecase'; | ||
import { GetSheetNames } from './get-sheet-names/get-sheet-names.usecase'; | ||
import { GetImportConfig } from './get-import-config/get-import-config.usecase'; | ||
|
||
import { ValidRequestCommand } from './valid-request/valid-request.command'; | ||
import { GetSheetNamesCommand } from './get-sheet-names/get-sheet-names.command'; | ||
|
||
export const USE_CASES = [ | ||
ValidRequest, | ||
GetSignedUrl, | ||
GetSheetNames, | ||
GetImportConfig, | ||
// | ||
]; | ||
|
||
export { GetSignedUrl, ValidRequest, GetImportConfig }; | ||
export { ValidRequestCommand }; | ||
export { GetSignedUrl, ValidRequest, GetImportConfig, GetSheetNames }; | ||
export { ValidRequestCommand, GetSheetNamesCommand }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
apps/widget/src/components/widget/Phases/ConfirmModal/Styles.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.