Skip to content

Commit

Permalink
Merge branch 'wip.email-multi-event' into refactor.date-fns
Browse files Browse the repository at this point in the history
  • Loading branch information
gulfaraz committed Jul 12, 2024
2 parents f60d4e9 + baafe39 commit 21141b4
Show file tree
Hide file tree
Showing 29 changed files with 746 additions and 168 deletions.
4 changes: 4 additions & 0 deletions services/API-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ For the rest, follow the same instructions as above to receive initial and follo
- Endpoint URL: `https://ibf.510.global/api/point-data/community-notification/${countryCodeISO3}`
- To test this locally you can replace `ibf.510.global` by a local ngrok address
- To demo on other environments, replace by respective environment-url, e.g. `ibf-test.510.global`

## API tests

1. Run them by `docker exec ibf-api-service npm run test:api:all`
16 changes: 16 additions & 0 deletions services/API-service/jest.api.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
moduleFileExtensions: ['js', 'ts'],
transform: {
'^.+\\.ts?$': ['ts-jest', { tsconfig: '<rootDir>/test/tsconfig.json' }],
},
rootDir: '.',
testMatch: ['<rootDir>/test/**/*.test.ts'],
coverageReporters: ['json', 'lcov'],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
testTimeout: 30_000,
verbose: true,
reporters: ['default'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export class RenameMockRasters1710512991479 implements MigrationInterface {

if (fs.existsSync(directoryPath)) {
const files = fs.readdirSync(directoryPath);
console.log('🚀 ~ RenameMockRasters1710512991479 ~ up ~ files:', files);

files.forEach((file) => {
if (!file.includes('hour_MWI')) {
const newFilename = file.replace(
Expand Down
2 changes: 2 additions & 0 deletions services/API-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"test": "jest --config=jest.json --detectOpenHandles --forceExit --passWithNoTests",
"test:dev": "npm test -- --watchAll",
"test:coverage": "npm test -- --coverage --coverageDirectory=coverage",
"test:api:all": "node --expose-gc node_modules/.bin/jest --config=jest.api.config.js --runInBand --detectOpenHandles --logHeapUsage",
"test:api:watch": "npm run test:api:all -- --watchAll",
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js",
"migration:generate": "npm run typeorm migration:generate -- -d ./appdatasource.ts",
"migration:run": "npm run typeorm migration:run -- -d ./appdatasource.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export class NotificationApiTestResponseDto {
activeEvents: NotificationApiTestResponseChannelDto;
finishedEvents: NotificationApiTestResponseChannelDto;
}

export class NotificationApiTestResponseChannelDto {
email: string;
whatsapp: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@ export class NotificationDataPerEventDto {
triggerStatusLabel: TriggerStatusLabelEnum;
eventName: string;
disasterSpecificCopy: DisasterSpecificCopy;

/**
* The day that the event starts.
*/
firstLeadTime: LeadTime;

/**
* The day that the event triggers. This could be different from firstLeadTimeString.
* For example, a flood could transition from a warning (a chance of a small flood)
* to an EAP trigger (a larger chance of a bigger flood).
*/
firstTriggerLeadTime: LeadTime;

firstLeadTimeString: string;
firstTriggerLeadTimeString: string;

triggeredAreas: TriggeredArea[];

/**
* The number of areas where the event triggers.
*/
nrOfTriggeredAreas: number;
startDateDisasterString: string;

totalAffectedOfIndicator: number;
mapImage?: Buffer;
issuedDate: Date;
Expand Down
Loading

0 comments on commit 21141b4

Please sign in to comment.