From 9d66e57533a72c2247768bcc80dbb3f0897fe7bb Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 16 Apr 2024 11:31:14 +0200 Subject: [PATCH] feature(CSVImport): Moves the CSV Import event to the start of processing --- .../geo-features/import/features-amounts-upload.service.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts b/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts index 7e59aa0d15..b595f75355 100644 --- a/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts +++ b/api/apps/api/src/modules/geo-features/import/features-amounts-upload.service.ts @@ -81,6 +81,8 @@ export class FeatureAmountUploadService { await apiQueryRunner.startTransaction(); await geoQueryRunner.startTransaction(); + await this.events.submittedEvent(data.projectId, data); + let newFeaturesFromCsvUpload; try { this.logger.log( @@ -151,14 +153,11 @@ export class FeatureAmountUploadService { await apiQueryRunner.commitTransaction(); await geoQueryRunner.commitTransaction(); - // This is done, for now, in order to avoid unnecessary polling from FE - await this.events.submittedEvent(data.projectId, data); await this.events.finishEvent(data.projectId); } catch (err) { await apiQueryRunner.rollbackTransaction(); await geoQueryRunner.rollbackTransaction(); - // This is done, for now, in order to avoid unnecessary polling from FE - await this.events.submittedEvent(data.projectId, data); + await this.events.failEvent(data.projectId, err); this.logger.error(