Skip to content

Commit

Permalink
Merge pull request #231 from credebl/184-bulk-issuance-start-issuance
Browse files Browse the repository at this point in the history
fix: Added the logs for the csv upload file
  • Loading branch information
Sheetal-ayanworks authored Nov 6, 2023
2 parents 32186ca + f0e19c2 commit 4241f25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions apps/issuance/src/issuance.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ export class IssuanceController {
async importCSV(payload: {
importFileDetails: ImportFileDetails
}): Promise<string> {
return this.issuanceService.importAndPreviewDataForIssuance(payload.importFileDetails);
this.logger.log(`payload.importFileDetails----${payload.importFileDetails}`);
return this.issuanceService.importAndPreviewDataForIssuance(payload.importFileDetails);
}

@MessagePattern({ cmd: 'preview-csv-details' })
async previewCSVDetails(payload: {requestId:string, previewFileDetails:PreviewRequest}): Promise<object> {
async previewCSVDetails(payload: { requestId: string, previewFileDetails: PreviewRequest }): Promise<object> {
return this.issuanceService.previewFileDataForIssuance(
payload.requestId,
payload.requestId,
payload.previewFileDetails
);
);
}

@MessagePattern({ cmd: 'issue-bulk-credentials' })
async issueBulkCredentials(payload: {requestId:string, orgId:number }): Promise<string> {
async issueBulkCredentials(payload: { requestId: string, orgId: number }): Promise<string> {
return this.issuanceService.issueBulkCredential(payload.requestId, payload.orgId);
}
}
5 changes: 4 additions & 1 deletion apps/issuance/src/issuance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ export class IssuanceService {


async importAndPreviewDataForIssuance(importFileDetails: ImportFileDetails): Promise<string> {
this.logger.log(`START importAndPreviewDataForIssuance`, importFileDetails);
this.logger.log(`START importAndPreviewDataForIssuance----${JSON.stringify(importFileDetails)}`);
try {

const credDefResponse =
await this.issuanceRepository.getCredentialDefinitionDetails(importFileDetails.credDefId);

this.logger.log(`credDefResponse----${JSON.stringify(credDefResponse)}`);

const csvFile = readFileSync(importFileDetails.filePath);
const csvData = csvFile.toString();
Expand All @@ -526,6 +528,7 @@ export class IssuanceService {
complete: (results) => results.data
});

this.logger.log(`parsedData----${JSON.stringify(parsedData)}`);

if (0 >= parsedData.data.length) {
throw new BadRequestException(`File data is empty`);
Expand Down

0 comments on commit 4241f25

Please sign in to comment.