-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
997436b
commit f7bbf56
Showing
4 changed files
with
176 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
"published": false, | ||
"state": "design", | ||
"location": "Kenya", | ||
"ngo": "KRCS", | ||
"countryId": 1, | ||
"title": { | ||
"en": "Pilot - Kenya" | ||
}, | ||
"description": { | ||
"en": "Program description" | ||
}, | ||
"descLocation": { | ||
"en": "Location such and such." | ||
}, | ||
"descHumanitarianObjective": { | ||
"en": "Humanitarian objective of program is such and such." | ||
}, | ||
"descCashType": { | ||
"en": "Unconditional multi-purpose" | ||
}, | ||
"startDate": "2020-01-01T12:00:00Z", | ||
"endDate": "2020-12-31T12:00:00Z", | ||
"currency": "KES", | ||
"distributionFrequency": "month", | ||
"distributionDuration": 3, | ||
"fixedTransferValue": 35, | ||
"financialServiceProviders": [ | ||
{ | ||
"id": 1 | ||
}, | ||
{ | ||
"id": 2 | ||
} | ||
], | ||
"inclusionCalculationType": "highestScoresX", | ||
"minimumScore": 0, | ||
"highestScoresX": 250, | ||
"meetingDocuments": { | ||
"en": "Document 1; Document 2; Document 3" | ||
}, | ||
"notifications": { | ||
"en": { | ||
"included": "You have been included in this program.", | ||
"rejected": "Unfortunately we have to inform you that you will not receive any (more) payments for this program. If you have questions, please contact us." | ||
} | ||
}, | ||
"customCriteria": [ | ||
{ | ||
"criterium": "name", | ||
"label": { | ||
"en": "My full name:" | ||
}, | ||
"answerType": "text", | ||
"criteriumType": "standard", | ||
"options": null, | ||
"persistence": true, | ||
"scoring": {} | ||
}, | ||
{ | ||
"criterium": "dob", | ||
"label": { | ||
"en": "My date of birth:" | ||
}, | ||
"answerType": "date", | ||
"criteriumType": "standard", | ||
"options": null, | ||
"persistence": true, | ||
"scoring": {} | ||
}, | ||
{ | ||
"criterium": "phoneNumber", | ||
"label": { | ||
"en": "My phonenumber:" | ||
}, | ||
"answerType": "tel", | ||
"criteriumType": "standard", | ||
"options": null, | ||
"persistence": true, | ||
"scoring": {} | ||
}, | ||
{ | ||
"criterium": "sample", | ||
"label": { | ||
"en": "1. Sample vulnerability question:" | ||
}, | ||
"answerType": "dropdown", | ||
"criteriumType": "standard", | ||
"options": [ | ||
{ | ||
"option": "optionA", | ||
"label": { | ||
"en": "Option A" | ||
} | ||
}, | ||
{ | ||
"option": "optionB", | ||
"label": { | ||
"en": "Option B" | ||
} | ||
}, | ||
{ | ||
"option": "optionC", | ||
"label": { | ||
"en": "Option C" | ||
} | ||
} | ||
], | ||
"scoring": { | ||
"optionA": 3, | ||
"optionB": 6, | ||
"optionC": 9 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
services/121-service/src/scripts/seed-program-pilot-ken.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { InterfaceScript } from './scripts.module'; | ||
import { Connection } from 'typeorm'; | ||
|
||
import { SeedHelper } from './seed-helper'; | ||
import { SeedInit } from './seed-init'; | ||
|
||
import { CountryEntity } from '../programs/country/country.entity'; | ||
import fspBank from '../../examples/fsp-bank.json'; | ||
import fspMobileMoney from '../../examples/fsp-mobile-money.json'; | ||
import programPilotKen from '../../examples/program-pilot-ken.json'; | ||
import { USERCONFIG } from '../secrets'; | ||
import { UserRole } from '../user-role.enum'; | ||
|
||
@Injectable() | ||
export class SeedPilotKenProgram implements InterfaceScript { | ||
public constructor(private connection: Connection) {} | ||
|
||
private readonly seedHelper = new SeedHelper(this.connection); | ||
|
||
public async run(): Promise<void> { | ||
const seedInit = await new SeedInit(this.connection); | ||
await seedInit.run(); | ||
|
||
// ***** CREATE USERS ***** | ||
await this.seedHelper.addUser({ | ||
role: UserRole.ProjectOfficer, | ||
email: USERCONFIG.emailProjectOfficer, | ||
countryId: USERCONFIG.countryId, | ||
password: USERCONFIG.passwordProjectOfficer, | ||
}); | ||
|
||
await this.seedHelper.addUser({ | ||
role: UserRole.ProgramManager, | ||
email: USERCONFIG.emailProgramManager, | ||
countryId: USERCONFIG.countryId, | ||
password: USERCONFIG.passwordProgramManager, | ||
}); | ||
|
||
// ***** CREATE COUNTRIES ***** | ||
const countryRepository = this.connection.getRepository(CountryEntity); | ||
await countryRepository.save([{ country: 'Kenya' }]); | ||
|
||
// ***** CREATE FINANCIAL SERVICE PROVIDERS ***** | ||
await this.seedHelper.addFsp(fspBank); | ||
await this.seedHelper.addFsp(fspMobileMoney); | ||
|
||
// ***** CREATE PROGRAM ***** | ||
const examplePrograms = [programPilotKen]; | ||
await this.seedHelper.addPrograms(examplePrograms, 1); | ||
} | ||
} | ||
|
||
export default SeedPilotKenProgram; |