Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
fix: Removes unnecessary usage of project validation endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Enngage committed May 4, 2022
1 parent b7e7fc6 commit 973c35b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/export/export.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export interface IExportData {
export interface IExportAllResult {
metadata: IPackageMetadata;
data: IExportData;
validation: ProjectContracts.IProjectReportResponseContract | {};
validation: ProjectContracts.IProjectReportResponseContract | undefined;
}
2 changes: 1 addition & 1 deletion lib/export/export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class ExportService {
workflowStepsCount: data.workflowSteps.length
}
},
validation: projectValidation ?? {},
validation: projectValidation,
data
};
}
Expand Down
23 changes: 13 additions & 10 deletions lib/node/cli/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,24 @@ const backupAsync = async (config: ICliFileConfig) => {
context: 'node.js'
});

const report = await exportService.exportProjectValidationAsync();

const response = await exportService.exportAllAsync();
const zipFileData = await zipService.createZipAsync(response);

await fileService.writeFileAsync(config.zipFilename, zipFileData);
const validation = response.validation;

if (exportContainsInconsistencies(report)) {
const logFilename: string = getLogFilename(config.zipFilename);
if (validation) {
if (exportContainsInconsistencies(validation)) {
const logFilename: string = getLogFilename(config.zipFilename);

console.log(`Project contains inconsistencies which may cause errors during project import.`);
console.log(`See '${logFilename}' for more details.`);
} else {
console.log(`Project does not contain any inconsistencies`)
}
}

await fileHelper.createFileInCurrentFolderAsync(logFilename, JSON.stringify(report));
const zipFileData = await zipService.createZipAsync(response);

console.log(`Project contains inconsistencies which may cause future import to not work.`);
console.log(`See '${logFilename}' for more details.`);
}
await fileService.writeFileAsync(config.zipFilename, zipFileData);

console.log('Completed');
};
Expand Down

0 comments on commit 973c35b

Please sign in to comment.