From 22986d7fc7aa5afedbecb46fa647871102a9ec75 Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Mon, 20 Jan 2025 14:02:29 +0100 Subject: [PATCH 1/3] chore: remove enableStopTrigger AB#32660 --- .../1737374068839-RemoveStopTrigger.ts | 17 +++++++++++++++++ .../src/api/country/country-disaster.entity.ts | 4 ---- .../src/api/country/country.service.ts | 2 -- .../src/api/country/dto/add-countries.dto.ts | 3 --- .../src/scripts/interfaces/country.interface.ts | 1 - .../API-service/src/scripts/json/countries.json | 1 - 6 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 services/API-service/migration/1737374068839-RemoveStopTrigger.ts diff --git a/services/API-service/migration/1737374068839-RemoveStopTrigger.ts b/services/API-service/migration/1737374068839-RemoveStopTrigger.ts new file mode 100644 index 000000000..b4f4da248 --- /dev/null +++ b/services/API-service/migration/1737374068839-RemoveStopTrigger.ts @@ -0,0 +1,17 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class RemoveStopTrigger1737374068839 implements MigrationInterface { + name = 'RemoveStopTrigger1737374068839'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IBF-app"."country-disaster-settings" DROP COLUMN "enableStopTrigger"`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE "IBF-app"."country-disaster-settings" ADD "enableStopTrigger" boolean NOT NULL DEFAULT true`, + ); + } +} diff --git a/services/API-service/src/api/country/country-disaster.entity.ts b/services/API-service/src/api/country/country-disaster.entity.ts index d74d927b6..042d9896d 100644 --- a/services/API-service/src/api/country/country-disaster.entity.ts +++ b/services/API-service/src/api/country/country-disaster.entity.ts @@ -104,10 +104,6 @@ export class CountryDisasterSettingsEntity { @Column({ default: true }) public enableEarlyActions: boolean; - @ApiProperty() - @Column({ default: true }) - public enableStopTrigger: boolean; - @ApiProperty() @Column({ default: false }) public isEventBased: boolean; diff --git a/services/API-service/src/api/country/country.service.ts b/services/API-service/src/api/country/country.service.ts index 71a7b8162..7c45da49e 100644 --- a/services/API-service/src/api/country/country.service.ts +++ b/services/API-service/src/api/country/country.service.ts @@ -185,8 +185,6 @@ export class CountryService { disaster.showMonthlyEapActions; countryDisasterSettingsEntity.enableEarlyActions = disaster.enableEarlyActions; - countryDisasterSettingsEntity.enableStopTrigger = - disaster.enableStopTrigger; countryDisasterSettingsEntity.monthlyForecastInfo = disaster.monthlyForecastInfo ? JSON.parse(JSON.stringify(disaster.monthlyForecastInfo)) diff --git a/services/API-service/src/api/country/dto/add-countries.dto.ts b/services/API-service/src/api/country/dto/add-countries.dto.ts index 7fb68af60..dfab4dc17 100644 --- a/services/API-service/src/api/country/dto/add-countries.dto.ts +++ b/services/API-service/src/api/country/dto/add-countries.dto.ts @@ -75,9 +75,6 @@ export class CountryDisasterSettingsDto { @ApiProperty({ example: true }) public enableEarlyActions?: boolean; - @ApiProperty({ example: true }) - public enableStopTrigger?: boolean; - @ApiProperty({ example: {} }) public monthlyForecastInfo?: object; diff --git a/services/API-service/src/scripts/interfaces/country.interface.ts b/services/API-service/src/scripts/interfaces/country.interface.ts index ae41014a5..454349daa 100644 --- a/services/API-service/src/scripts/interfaces/country.interface.ts +++ b/services/API-service/src/scripts/interfaces/country.interface.ts @@ -27,7 +27,6 @@ export interface CountryDisasterSettings { eapAlertClasses?: EapAlertClasses; monthlyForecastInfo?: Record; enableEarlyActions?: boolean; - enableStopTrigger?: boolean; } export interface NotificationInfo { diff --git a/services/API-service/src/scripts/json/countries.json b/services/API-service/src/scripts/json/countries.json index cd4967568..808d579d7 100644 --- a/services/API-service/src/scripts/json/countries.json +++ b/services/API-service/src/scripts/json/countries.json @@ -440,7 +440,6 @@ ], "eapLink": "https://510ibfsystem.blob.core.windows.net/about-trigger/MWI-flashfloods-about.pdf", "enableEarlyActions": false, - "enableStopTrigger": false, "isEventBased": true } ], From 9e43b18b3b48238feece99fe25b1eb191782e46c Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Fri, 24 Jan 2025 09:24:26 +0100 Subject: [PATCH 2/3] chore: empty stop-trigger data --- .../migration/1737374068839-RemoveStopTrigger.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/API-service/migration/1737374068839-RemoveStopTrigger.ts b/services/API-service/migration/1737374068839-RemoveStopTrigger.ts index b4f4da248..5683e3164 100644 --- a/services/API-service/migration/1737374068839-RemoveStopTrigger.ts +++ b/services/API-service/migration/1737374068839-RemoveStopTrigger.ts @@ -7,6 +7,17 @@ export class RemoveStopTrigger1737374068839 implements MigrationInterface { await queryRunner.query( `ALTER TABLE "IBF-app"."country-disaster-settings" DROP COLUMN "enableStopTrigger"`, ); + + // Empty stop-trigger columns, as we are removing the functionality, just keeping the columns to repurpose them later + await queryRunner.query( + `UPDATE "IBF-app"."event-place-code" SET "stopped" = false`, + ); + await queryRunner.query( + `UPDATE "IBF-app"."event-place-code" SET "manualStoppedDate" = null`, + ); + await queryRunner.query( + `UPDATE "IBF-app"."event-place-code" SET "userUserId" = null`, + ); } public async down(queryRunner: QueryRunner): Promise { From 36bb8db4bf3c03d3b23757358a066e7c1b51ccb0 Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Fri, 24 Jan 2025 09:38:29 +0100 Subject: [PATCH 3/3] feat: remove stop propertise from trigger log AB#32660 --- services/API-service/src/api/event/event.service.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/API-service/src/api/event/event.service.ts b/services/API-service/src/api/event/event.service.ts index e6649e612..d4c71a6d5 100644 --- a/services/API-service/src/api/event/event.service.ts +++ b/services/API-service/src/api/event/event.service.ts @@ -491,8 +491,6 @@ export class EventService { 'area."placeCode" AS "placeCode"', 'area.name AS name', 'event."startDate"', - 'event.stopped as stopped', - 'case when event.stopped = true then event."manualStoppedDate" end as "stopDate"', 'event.closed as closed', 'case when event.closed = true then event."endDate" end as "endDate"', 'disaster."actionsUnit" as "exposureIndicator"',