-
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.
- Loading branch information
Showing
23 changed files
with
195 additions
and
175 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
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
11 changes: 7 additions & 4 deletions
11
apps/api/src/app/mapping/usecases/get-mappings/get-mappings.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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { MappingRepository } from '@impler/dal'; | ||
import { UploadRepository } from '@impler/dal'; | ||
import { ITemplateSchemaItem } from '@impler/shared'; | ||
|
||
@Injectable() | ||
export class GetMappings { | ||
constructor(private mappingRepository: MappingRepository) {} | ||
constructor(private uploadRepository: UploadRepository) {} | ||
|
||
async execute(_uploadId: string) { | ||
return await this.mappingRepository.getMappingInfo(_uploadId); | ||
async execute(_uploadId: string): Promise<ITemplateSchemaItem[]> { | ||
const uploadInfo = await this.uploadRepository.findById(_uploadId, 'customSchema'); | ||
|
||
return JSON.parse(uploadInfo.customSchema); | ||
} | ||
} |
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
13 changes: 7 additions & 6 deletions
13
apps/api/src/app/mapping/usecases/rename-file-headings/rename-file-headings.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
17 changes: 10 additions & 7 deletions
17
apps/api/src/app/mapping/usecases/update-mappings/update-mappings.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 |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { MappingRepository } from '@impler/dal'; | ||
import { UpdateMappingCommand } from './update-mappings.command'; | ||
import { UploadRepository } from '@impler/dal'; | ||
import { ITemplateSchemaItem } from '@impler/shared'; | ||
|
||
@Injectable() | ||
export class UpdateMappings { | ||
constructor(private mappingRepository: MappingRepository) {} | ||
constructor(private uploadRepository: UploadRepository) {} | ||
|
||
async execute(command: UpdateMappingCommand[], _uploadId: string) { | ||
await this.mappingRepository.deleteMany({ _uploadId }); | ||
|
||
return this.mappingRepository.createMany(command); | ||
async execute(templateSchema: ITemplateSchemaItem[], _uploadId: string) { | ||
await this.uploadRepository.update( | ||
{ | ||
_id: _uploadId, | ||
}, | ||
{ customSchema: JSON.stringify(templateSchema) } | ||
); | ||
} | ||
} |
10 changes: 7 additions & 3 deletions
10
apps/api/src/app/mapping/usecases/validate-mapping/validate-mapping.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
31 changes: 8 additions & 23 deletions
31
apps/api/src/app/mapping/usecases/validate-mapping/validate-mapping.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
Oops, something went wrong.