From 9b310363862c55a8a95b41e9fd23951f1f3210f6 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..acc120f5dc 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 @@ -72,6 +72,8 @@ export class FeatureAmountUploadService { projectId: string; userId: string; }): Promise | Right> { + await this.events.submittedEvent(data.projectId, data); + const apiQueryRunner = this.apiDataSource.createQueryRunner(); const geoQueryRunner = this.geoDataSource.createQueryRunner(); @@ -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(