From 5b152ce0ff4b0213f26bd4ada2c036922a6f5901 Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 20 Jan 2025 12:33:03 +0200 Subject: [PATCH 1/8] feat: update summary configuration --- package.json | 2 +- src/form/tennis-club-membership.ts | 76 +++++++++++++++++++----------- yarn.lock | 8 ++-- 3 files changed, 54 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 096dea5dd..e409ad053 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/toolkit": "0.0.14-events", + "@opencrvs/toolkit": "0.0.16-events", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", "@types/fhir": "^0.0.30", diff --git a/src/form/tennis-club-membership.ts b/src/form/tennis-club-membership.ts index ede50e298..67946642f 100644 --- a/src/form/tennis-club-membership.ts +++ b/src/form/tennis-club-membership.ts @@ -182,48 +182,70 @@ export const tennisClubMembershipEvent = defineConfig({ }, summary: { title: { - defaultMessage: '{applicant.firstname} {applicant.surname}', - description: 'This is the title of the summary', - id: 'event.tennis-club-membership.summary.title' + id: 'event.tennis-club-membership.summary.title', + label: { + defaultMessage: '{applicant.firstname} {applicant.surname}', + description: 'This is the title of the summary', + id: 'event.tennis-club-membership.summary.title' + }, + emptyValueMessage: { + defaultMessage: 'Membership application', + description: + 'This is the message shown when the applicant name is missing', + id: 'event.tennis-club-membership.summary.title.empty' + } }, fields: [ { - id: 'applicant.firstname', + id: 'event.tennis-club-membership.summary.applicant.name', + label: { + defaultMessage: 'Applicant', + description: 'This is the label for the field', + id: 'event.tennis-club-membership.summary.field.name.label' + }, + value: { + defaultMessage: '{applicant.firstname} {applicant.surname}', + id: 'event.tennis-club-membership.summary.field.name.label', + description: 'This is the value for the field' + }, emptyValueMessage: { - defaultMessage: "Applicant's first name missing", + defaultMessage: "Applicant's name is missing", description: - "shown when the applicant's first name is missing in summary", + "shown when the applicant's names are missing in summary", id: 'event.tennis-club-membership.summary.field.applicant.firstname.empty' } }, { - id: 'applicant.surname', - emptyValueMessage: { - defaultMessage: "Applicant's surname missing", - description: 'shown when the surname is missing in summary', - id: 'event.tennis-club-membership.summary.field.applicant.surname.empty' - } - }, - { - id: 'recommender.firstname', - emptyValueMessage: { - defaultMessage: "Recommender's first name missing", - description: - 'shown when the recommender first name is missing in summary', - id: 'event.tennis-club-membership.summary.field.recommender.firstname.empty' - } - }, - { - id: 'recommender.surname', + id: 'event.tennis-club-membership.summary.recommender.name', + label: { + defaultMessage: 'Recommender', + description: 'This is the label for the field', + id: 'event.tennis-club-membership.summary.field.recommender.name.label' + }, + value: { + defaultMessage: '{recommender.firstname} {recommender.surname}', + id: 'event.tennis-club-membership.summary.field.name.label', + description: 'This is the value for the field' + }, emptyValueMessage: { - defaultMessage: "Recommender's surname missing", + defaultMessage: "Recommender's name is missing", description: - 'shown when the recommender surname is missing in summary', - id: 'event.tennis-club-membership.summary.field.recommender.surname.empty' + "shown when the recommender's names are missing in summary", + id: 'event.tennis-club-membership.summary.field.recommender.name.empty' } }, { id: 'recommender.id', + label: { + defaultMessage: 'Membership ID', + description: 'This is the label for the field', + id: 'event.tennis-club-membership.summary.field.recommender.id.label' + }, + value: { + defaultMessage: '{recommender.id}', + id: 'event.tennis-club-membership.summary.field.recommender.id', + description: 'This is the value for the field' + }, emptyValueMessage: { defaultMessage: "Recommender's id missing", description: 'shown when the recommender id is missing in summary', diff --git a/yarn.lock b/yarn.lock index 2c8c34061..e6dfdb7b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,10 +790,10 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/toolkit@0.0.14-events": - version "0.0.14-events" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.14-events.tgz#f99b2dc14c30ec925f373e19eea5ea731abb79b9" - integrity sha512-ZsSmmgB9anSVp2hxIquU/wfHVP8s//RydEVERmn7Dpr3S/6bVRsLS27P02lioJmCBMbEf8cNgstyMlgaE9XpAg== +"@opencrvs/toolkit@0.0.16-events": + version "0.0.16-events" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.16-events.tgz#63ab3ab4961433f43559443a0c79ec38401476ea" + integrity sha512-0Iyfjm3JNmdXOvrf6zewHPJwxYkCvzAnZiYDzQGpssQ5ErWrf2pAkMw9dzp+P0F2G48lrgqtl+UQwsi1LVVFHg== dependencies: ajv "^8.17.1" From 3ae93db08479d37cf8549b874c6e34de9495e446 Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 20 Jan 2025 14:05:28 +0200 Subject: [PATCH 2/8] fix: change summary for birth event --- src/form/v2/birth/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/form/v2/birth/index.ts b/src/form/v2/birth/index.ts index ce0ff48e6..295b35c79 100644 --- a/src/form/v2/birth/index.ts +++ b/src/form/v2/birth/index.ts @@ -26,9 +26,12 @@ export const birthEvent = defineConfig({ }, summary: { title: { - defaultMessage: '{applicant.firstname} {applicant.surname}', - description: 'This is the title of the summary', - id: 'event.birth.summary.title' + id: 'event.birth.summary.title', + label: { + defaultMessage: '{applicant.firstname} {applicant.surname}', + description: 'This is the title of the summary', + id: 'event.birth.summary.title' + } }, fields: [] }, From d23df44416ffc3915abd155778bda4c6a3fd36e2 Mon Sep 17 00:00:00 2001 From: Pyry Rouvila Date: Tue, 21 Jan 2025 13:02:19 +0200 Subject: [PATCH 3/8] chore: remove png images from svg certificates (#371) * chore: remove png images from svg certificates * refactor: comment out the mosip stuff for simplicity --- .../birth-certificate-certified-copy.svg | 22 +++++++++++++--- .../certificates/source/birth-certificate.svg | 26 +++++++++++++------ .../death-certificate-certified-copy.svg | 16 +++++++++++- .../certificates/source/death-certificate.svg | 16 +++++++++++- .../marriage-certificate-certified-copy.svg | 16 +++++++++++- .../source/marriage-certificate.svg | 16 +++++++++++- 6 files changed, 96 insertions(+), 16 deletions(-) diff --git a/src/api/certificates/source/birth-certificate-certified-copy.svg b/src/api/certificates/source/birth-certificate-certified-copy.svg index a279fbb87..bb9f23bfa 100644 --- a/src/api/certificates/source/birth-certificate-certified-copy.svg +++ b/src/api/certificates/source/birth-certificate-certified-copy.svg @@ -14,12 +14,12 @@ Place of certification / Lieu de certification - - 12345678912345678912345678900 + Certified by: {{registrar.name}} @@ -317,7 +317,22 @@ {{ registrar.name }} + + + + + + + + + + + + + + + @@ -379,7 +394,6 @@ - {{#ifCond printInAdvance '!==' true}} diff --git a/src/api/certificates/source/birth-certificate.svg b/src/api/certificates/source/birth-certificate.svg index 506461702..2a9793f08 100644 --- a/src/api/certificates/source/birth-certificate.svg +++ b/src/api/certificates/source/birth-certificate.svg @@ -48,16 +48,12 @@ Place of certification / Lieu de délivrance - + @@ -245,7 +241,22 @@ + + + + + + + + + + + + + + + @@ -286,7 +297,6 @@ - {{#ifCond printInAdvance '!==' true}} diff --git a/src/api/certificates/source/death-certificate-certified-copy.svg b/src/api/certificates/source/death-certificate-certified-copy.svg index 804ee925e..27cc4b114 100644 --- a/src/api/certificates/source/death-certificate-certified-copy.svg +++ b/src/api/certificates/source/death-certificate-certified-copy.svg @@ -234,7 +234,22 @@ + + + + + + + + + + + + + + + @@ -278,7 +293,6 @@ - {{#ifCond printInAdvance '!==' true}} diff --git a/src/api/certificates/source/death-certificate.svg b/src/api/certificates/source/death-certificate.svg index c489f10db..68df6ebd4 100644 --- a/src/api/certificates/source/death-certificate.svg +++ b/src/api/certificates/source/death-certificate.svg @@ -214,7 +214,22 @@ CERTIFICATE OF DEATH / ACTE DE DEATH + + + + + + + + + + + + + + + @@ -252,7 +267,6 @@ - {{#ifCond printInAdvance '!==' true}} diff --git a/src/api/certificates/source/marriage-certificate-certified-copy.svg b/src/api/certificates/source/marriage-certificate-certified-copy.svg index 174336193..0d204c59d 100644 --- a/src/api/certificates/source/marriage-certificate-certified-copy.svg +++ b/src/api/certificates/source/marriage-certificate-certified-copy.svg @@ -311,7 +311,22 @@ + + + + + + + + + + + + + + + @@ -373,7 +388,6 @@ - {{#ifCond printInAdvance '!==' true}} diff --git a/src/api/certificates/source/marriage-certificate.svg b/src/api/certificates/source/marriage-certificate.svg index cb9b3f87c..bcd4927a0 100644 --- a/src/api/certificates/source/marriage-certificate.svg +++ b/src/api/certificates/source/marriage-certificate.svg @@ -217,7 +217,22 @@ + + + + + + + + + + + + + + + @@ -258,7 +273,6 @@ - From ea711a2f0b75e9eee1ec5ad2bac64a4a22e6b7e3 Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Thu, 23 Jan 2025 18:39:59 +0600 Subject: [PATCH 4/8] Configurable roles (#352) * feat: add roles migrator & new handler * fix: inline functions to make the script independent * feat: use SCOPES constant from toolkit * docs: migration notes * feat: generate roles.ts file instead of json * docs: update CHANGELOG * chore: remove systemRole after migration * feat: migrate roles * docs: update CHANGELOG * feat: update the prod-employees.csv during upgrade * feat: add strict typing to roles.ts * chore: change the migration script to be run before upgrade * fix: skip prod-employees file if not available * chore: fix logs * fix: event import --- CHANGELOG.md | 13 + package.json | 10 +- src/api/certificates/handler.ts | 13 +- .../employees/source/default-employees.csv | 24 +- src/data-seeding/roles/handler.ts | 30 +- src/data-seeding/roles/roles.ts | 244 ++++++++++++ src/data-seeding/roles/source/roles.csv | 12 - src/data-seeding/roles/validator.ts | 29 -- src/index.ts | 1 + src/translations/client.csv | 11 + src/upgrade-to-1_7.ts | 367 ++++++++++++++++++ src/utils/index.ts | 6 +- tsconfig.json | 1 + yarn.lock | 58 ++- 14 files changed, 707 insertions(+), 112 deletions(-) create mode 100644 src/data-seeding/roles/roles.ts delete mode 100644 src/data-seeding/roles/source/roles.csv delete mode 100644 src/data-seeding/roles/validator.ts create mode 100644 src/upgrade-to-1_7.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa5451ce..4cb14e854 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,27 @@ ## 1.7.0 Release candidate +### Migration notes +In order to make the upgrade easier, there are a couple of steps that need to be performed which will make the codebase ready for the upgrade: +- Run this command from the root of the countryconfig repository ```curl https://raw.githubusercontent.com/opencrvs/opencrvs-countryconfig/configurable-roles/src/upgrade-to-1_7.ts | npx ts-node -T --cwd ./src``` + + It will remove `roles.csv` and generate a `roles.ts` file. It will also update the corresponding role column in `default-employees.csv` & `prod-employees.csv` while adding the corresponding translations in `client.csv`. The employee files are only used when seeding new environments, if you already have a v1.6.x of OpenCRVS deployed, the data in the environment will automatically get migrated after deploying the upgrade. The changes in these two files are made to keep the roles in sync with your previously deployed environments, if any. +- After pulling in the v1.7.0 changes reject the changes incoming to `roles.ts`, `default-employees.csv` & `prod-employees.csv` files as we used the script above to auto-generate them. + + The `roles.ts` file now defines all the roles available in the system. New roles can be added & existing roles can be customized by giving them different scopes. + + *N.B. The default roles generated in the `roles.ts` file during migration should not be removed to maintain backwards compatibility* + ### Breaking changes - `INFORMANT_SIGNATURE` & `INFORMANT_SIGNATURE_REQUIRED` are now deprecated - Existing implementations relying on database-stored SVGs need to be updated to use the new configuration-based approach. A migration needs to be run (defined in [migration](https://github.com/opencrvs/opencrvs-core/pull/7813/files#diff-e5472dec87399bb9f73f75ec379ceb6a32ca135bc01dd8d0eb8f7d7aaa0bc0b1)), and default certificate templates must be created for each event type, following the convention `${event}-certificate` as the certificate template ID. +- **Roles** The previous `roles.csv` file has been deprecated. It will get removed once you run `yarn upgrade:code` command after pulling in the v1.7 changes. The command automatically generates a `roles.json` file which can be used as a baseline to configure the roles as per your requirements. ### New features - Update the translations for System user add/edit form, `Last name` to `User's surname` and `First name` to `User's first name` to make them less confusing for system users [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830) +- **User scopes** Introduce granular scopes to grant specific permissions to a particular role. The specifics about the introduced scopes can be found here: *Link to scopes description file* - **Refactored certificate handling:** SVGs are no longer stored in the database; streamlined configurations now include certificate details, and clients request SVGs directly via URLs. - Add constant.humanName to allow countries to have custom ordering on their full name e.g. start with `lastName` or `firstName` [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830) diff --git a/package.json b/package.json index 5a6e1c4ff..101fec91b 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,8 @@ "@typescript-eslint/parser": "^5.60.1", "cypress-xpath": "^2.0.1", "eslint": "^8.43.0", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-prettier": "^4.2.1", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", "husky": "1.0.0-rc.13", "inquirer": "^9.2.12", "js-yaml": "^4.1.0", @@ -55,7 +55,7 @@ "node-ssh": "^13.2.0", "nodemon": "^2.0.22", "pino-pretty": "^11.0.0", - "prettier": "^2.8.8", + "prettier": "^3.4.2", "react-intl": "^6.4.3", "vitest": "^2.1.2" }, @@ -64,7 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/toolkit": "0.0.19-events-ml", + "@opencrvs/toolkit": "0.0.22-scopes", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", "@types/fhir": "^0.0.30", @@ -73,7 +73,7 @@ "@types/hapi__hapi": "^20.0.0", "@types/jwt-decode": "^2.2.1", "@types/lodash": "^4.14.117", - "@types/node": "^10.12.5", + "@types/node": "^18.19.1", "@types/node-fetch": "^2.6.2", "@types/nodemailer": "^6.4.14", "app-module-path": "^2.2.0", diff --git a/src/api/certificates/handler.ts b/src/api/certificates/handler.ts index 8929c55c7..7f15b64f6 100644 --- a/src/api/certificates/handler.ts +++ b/src/api/certificates/handler.ts @@ -9,6 +9,7 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ +import { Event } from '@countryconfig/form/types/types' import { Request, ResponseToolkit } from '@hapi/hapi' type FontFamilyTypes = { @@ -43,7 +44,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { const certificateConfigs: ICertificateConfigData[] = [ { id: 'birth-certificate', - event: 'birth', + event: Event.Birth, label: { id: 'certificates.birth.certificate', defaultMessage: 'Birth Certificate', @@ -67,7 +68,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { }, { id: 'birth-certificate-certified-copy', - event: 'birth', + event: Event.Birth, label: { id: 'certificates.birth.certificate.copy', defaultMessage: 'Birth Certificate certified copy', @@ -92,7 +93,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { }, { id: 'death-certificate', - event: 'death', + event: Event.Death, label: { id: 'certificates.death.certificate', defaultMessage: 'Death Certificate', @@ -116,7 +117,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { }, { id: 'death-certificate-certified-copy', - event: 'death', + event: Event.Death, label: { id: 'certificates.death.certificate.copy', defaultMessage: 'Death Certificate certified copy', @@ -141,7 +142,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { }, { id: 'marriage-certificate', - event: 'marriage', + event: Event.Marriage, label: { id: 'certificates.marriage.certificate', defaultMessage: 'Marriage Certificate', @@ -165,7 +166,7 @@ export async function certificateHandler(request: Request, h: ResponseToolkit) { }, { id: 'marriage-certificate-certified-copy', - event: 'marriage', + event: Event.Marriage, label: { id: 'certificates.marriage.certificate.copy', defaultMessage: 'Marriage Certificate certified copy', diff --git a/src/data-seeding/employees/source/default-employees.csv b/src/data-seeding/employees/source/default-employees.csv index 1888c3a03..f3cc79280 100644 --- a/src/data-seeding/employees/source/default-employees.csv +++ b/src/data-seeding/employees/source/default-employees.csv @@ -1,12 +1,12 @@ -primaryOfficeId,givenNames,familyName,systemRole,role,mobile,username,email,password -CRVS_OFFICE_JWMRGwDBXK,Kalusha,Bwalya,FIELD_AGENT,Social Worker,+260911111111,k.bwalya,kalushabwalya17@gmail.com,test -CRVS_OFFICE_JWMRGwDBXK,Felix,Katongo,REGISTRATION_AGENT,Registration Agent,+260922222222,f.katongo,kalushabwalya17+@gmail.com,test -CRVS_OFFICE_JWMRGwDBXK,Kennedy,Mweene,LOCAL_REGISTRAR,Local Registrar,+260933333333,k.mweene,kalushabwalya1.7@gmail.com,test -CRVS_OFFICE_JWMRGwDBXK,Emmanuel,Mayuka,LOCAL_SYSTEM_ADMIN,Local System Admin,+260921681112,e.mayuka,kalushabwalya.17@gmail.com,test -CRVS_OFFICE_2OKicPQMNI,Jonathan,Campbell,NATIONAL_SYSTEM_ADMIN,National System Admin,+260921111111,j.campbell,kalushabwaly.a17@gmail.com,test -CRVS_OFFICE_okQp4uKCz0,Patrick,Gondwe,FIELD_AGENT,Local Leader,+260912121212,p.gondwe,kalushabwal.ya17@gmail.com,test -CRVS_OFFICE_okQp4uKCz0,Joshua,Mutale,REGISTRATION_AGENT,Registration Agent,+260923232323,j.mutale,kalushabwa.lya17@gmail.com,test -CRVS_OFFICE_okQp4uKCz0,Derrick,Bulaya,LOCAL_REGISTRAR,Local Registrar,+260934343434,d.bulaya,kalushabw.alya17@gmail.com,test -CRVS_OFFICE_okQp4uKCz0,Alex,Ngonga,LOCAL_SYSTEM_ADMIN,Local System Admin,+260978787878,a.ngonga,kalushab.walya17@gmail.com,test -CRVS_OFFICE_2OKicPQMNI,Edgar,Kazembe,PERFORMANCE_MANAGEMENT,Performance Manager,+260977777777,e.kazembe,kalusha.bwalya17@gmail.com,test -CRVS_OFFICE_2OKicPQMNI,Joseph,Musonda,NATIONAL_REGISTRAR,National Registrar,+260915151515,j.musonda,kalush.abwalya17@gmail.com,test +primaryOfficeId,givenNames,familyName,role,mobile,username,email,password +CRVS_OFFICE_JWMRGwDBXK,Kalusha,Bwalya,SOCIAL_WORKER,+260911111111,k.bwalya,kalushabwalya17@gmail.com,test +CRVS_OFFICE_JWMRGwDBXK,Felix,Katongo,REGISTRATION_AGENT,+260922222222,f.katongo,kalushabwalya17+@gmail.com,test +CRVS_OFFICE_JWMRGwDBXK,Kennedy,Mweene,LOCAL_REGISTRAR,+260933333333,k.mweene,kalushabwalya1.7@gmail.com,test +CRVS_OFFICE_JWMRGwDBXK,Emmanuel,Mayuka,LOCAL_SYSTEM_ADMIN,+260921681112,e.mayuka,kalushabwalya.17@gmail.com,test +CRVS_OFFICE_2OKicPQMNI,Jonathan,Campbell,NATIONAL_SYSTEM_ADMIN,+260921111111,j.campbell,kalushabwaly.a17@gmail.com,test +CRVS_OFFICE_okQp4uKCz0,Patrick,Gondwe,LOCAL_LEADER,+260912121212,p.gondwe,kalushabwal.ya17@gmail.com,test +CRVS_OFFICE_okQp4uKCz0,Joshua,Mutale,REGISTRATION_AGENT,+260923232323,j.mutale,kalushabwa.lya17@gmail.com,test +CRVS_OFFICE_okQp4uKCz0,Derrick,Bulaya,LOCAL_REGISTRAR,+260934343434,d.bulaya,kalushabw.alya17@gmail.com,test +CRVS_OFFICE_okQp4uKCz0,Alex,Ngonga,LOCAL_SYSTEM_ADMIN,+260978787878,a.ngonga,kalushab.walya17@gmail.com,test +CRVS_OFFICE_2OKicPQMNI,Edgar,Kazembe,PERFORMANCE_MANAGER,+260977777777,e.kazembe,kalusha.bwalya17@gmail.com,test +CRVS_OFFICE_2OKicPQMNI,Joseph,Musonda,NATIONAL_REGISTRAR,+260915151515,j.musonda,kalush.abwalya17@gmail.com,test diff --git a/src/data-seeding/roles/handler.ts b/src/data-seeding/roles/handler.ts index 4a611c563..b0de93462 100644 --- a/src/data-seeding/roles/handler.ts +++ b/src/data-seeding/roles/handler.ts @@ -8,34 +8,18 @@ * * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import { readCSVToJSON } from '@countryconfig/utils' +import { PRODUCTION, QA_ENV } from '@countryconfig/constants' +import { roles } from './roles' import { Request, ResponseToolkit } from '@hapi/hapi' -import { RoleSchema, Role } from './validator' export async function rolesHandler(_: Request, h: ResponseToolkit) { - const rawRoles: unknown[] = await readCSVToJSON( - './src/data-seeding/roles/source/roles.csv' - ) - const roles = RoleSchema.parse(rawRoles) - .map(({ systemRole, ...rest }) => { + if (!PRODUCTION || QA_ENV) { + return roles.map((role) => { return { - systemRole, - labels: Object.entries(rest).map( - ([key, value]: [Exclude, string]) => ({ - lang: key.split('_')[1], - label: value - }) - ) + ...role, + scopes: [...role.scopes, 'demo'] } }) - .reduce< - Record }>> - >((acc, role) => { - if (!acc[role.systemRole]) { - acc[role.systemRole] = [] - } - acc[role.systemRole].push({ labels: role.labels }) - return acc - }, {}) + } return h.response(roles) } diff --git a/src/data-seeding/roles/roles.ts b/src/data-seeding/roles/roles.ts new file mode 100644 index 000000000..ed7ee7f15 --- /dev/null +++ b/src/data-seeding/roles/roles.ts @@ -0,0 +1,244 @@ +import { SCOPES, Scope } from '@opencrvs/toolkit/scopes' +import { MessageDescriptor } from 'react-intl' + +type Role = { + id: string + label: MessageDescriptor + scopes: Scope[] +} + +export const roles: Role[] = [ + { + id: 'FIELD_AGENT', + label: { + defaultMessage: 'Field Agent', + description: 'Name for user role Field Agent', + id: 'userRole.fieldAgent' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'POLICE_OFFICER', + label: { + defaultMessage: 'Police Officer', + description: 'Name for user role Police Officer', + id: 'userRole.policeOfficer' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'SOCIAL_WORKER', + label: { + defaultMessage: 'Social Worker', + description: 'Name for user role Social Worker', + id: 'userRole.socialWorker' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'HEALTHCARE_WORKER', + label: { + defaultMessage: 'Healthcare Worker', + description: 'Name for user role Healthcare Worker', + id: 'userRole.healthcareWorker' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'LOCAL_LEADER', + label: { + defaultMessage: 'Local Leader', + description: 'Name for user role Local Leader', + id: 'userRole.localLeader' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'REGISTRATION_AGENT', + label: { + defaultMessage: 'Registration Agent', + description: 'Name for user role Registration Agent', + id: 'userRole.registrationAgent' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_APPROVAL, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'LOCAL_REGISTRAR', + label: { + defaultMessage: 'Local Registrar', + description: 'Name for user role Local Registrar', + id: 'userRole.localRegistrar' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_REVIEW_DUPLICATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.REGISTER, + SCOPES.RECORD_REGISTRATION_CORRECT, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_UNASSIGN_OTHERS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.RECORD_CONFIRM_REGISTRATION, + SCOPES.RECORD_REJECT_REGISTRATION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PROFILE_ELECTRONIC_SIGNATURE, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + }, + { + id: 'LOCAL_SYSTEM_ADMIN', + label: { + defaultMessage: 'Local System Admin', + description: 'Name for user role Local System Admin', + id: 'userRole.localSystemAdmin' + }, + scopes: [ + SCOPES.USER_READ_MY_OFFICE, + SCOPES.USER_CREATE_MY_JURISDICTION, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS + ] + }, + { + id: 'NATIONAL_SYSTEM_ADMIN', + label: { + defaultMessage: 'National System Admin', + description: 'Name for user role National System Admin', + id: 'userRole.nationalSystemAdmin' + }, + scopes: [ + SCOPES.USER_CREATE, + SCOPES.USER_READ, + SCOPES.USER_UPDATE, + SCOPES.ORGANISATION_READ_LOCATIONS, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS, + SCOPES.CONFIG_UPDATE_ALL + ] + }, + { + id: 'PERFORMANCE_MANAGER', + label: { + defaultMessage: 'Performance Manager', + description: 'Name for user role Performance Manager', + id: 'userRole.performanceManager' + }, + scopes: [ + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS + ] + }, + { + id: 'NATIONAL_REGISTRAR', + label: { + defaultMessage: 'National Registrar', + description: 'Name for user role National Registrar', + id: 'userRole.nationalRegistrar' + }, + scopes: [ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_REVIEW_DUPLICATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.REGISTER, + SCOPES.RECORD_REGISTRATION_CORRECT, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_UNASSIGN_OTHERS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.RECORD_CONFIRM_REGISTRATION, + SCOPES.RECORD_REJECT_REGISTRATION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS, + SCOPES.PROFILE_ELECTRONIC_SIGNATURE, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.USER_READ_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ] + } +] diff --git a/src/data-seeding/roles/source/roles.csv b/src/data-seeding/roles/source/roles.csv deleted file mode 100644 index 0606409b2..000000000 --- a/src/data-seeding/roles/source/roles.csv +++ /dev/null @@ -1,12 +0,0 @@ -systemRole,label_en,label_fr -FIELD_AGENT,Field Agent,Agent de terrain -FIELD_AGENT,Police Officer,Officier de police -FIELD_AGENT,Social Worker,Travailleur social -FIELD_AGENT,Healthcare Worker,Personnel de santé -FIELD_AGENT,Local Leader,Leader local -REGISTRATION_AGENT,Registration Agent,Agent d'enregistrement -LOCAL_REGISTRAR,Local Registrar,Registraire local -LOCAL_SYSTEM_ADMIN,Local System Admin,Administrateur système local -NATIONAL_SYSTEM_ADMIN,National System Admin,Administrateur système national -PERFORMANCE_MANAGEMENT,Performance Manager,Gestion des performances -NATIONAL_REGISTRAR,National Registrar,Registraire national diff --git a/src/data-seeding/roles/validator.ts b/src/data-seeding/roles/validator.ts deleted file mode 100644 index 02c2d9c01..000000000 --- a/src/data-seeding/roles/validator.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * OpenCRVS is also distributed under the terms of the Civil Registration - * & Healthcare Disclaimer located at http://opencrvs.org/license. - * - * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. - */ -import { TypeOf, z } from 'zod' - -export type Role = TypeOf[number] - -export const RoleSchema = z.array( - z.object({ - systemRole: z.enum([ - 'FIELD_AGENT', - 'REGISTRATION_AGENT', - 'LOCAL_REGISTRAR', - 'LOCAL_SYSTEM_ADMIN', - 'NATIONAL_SYSTEM_ADMIN', - 'PERFORMANCE_MANAGEMENT', - 'NATIONAL_REGISTRAR' - ]), - label_en: z.string(), - label_fr: z.string() - }) -) diff --git a/src/index.ts b/src/index.ts index de3527e12..5cdc0486e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -497,6 +497,7 @@ export async function createServer() { path: '/roles', handler: rolesHandler, options: { + auth: false, tags: ['api', 'user-roles'], description: 'Returns user roles metadata' } diff --git a/src/translations/client.csv b/src/translations/client.csv index 18e29f1f8..aaf5796ad 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -2272,6 +2272,17 @@ user.profile.roleType,Title for roleType field,Role,Rôle/Type user.profile.sectionTitle.audit,Title for audit section,History,Historique user.profile.startDate,Title for startDate field,Start date,Date de début user.profile.userName,Title for userName field,Username,Nom d'utilisateur +userRole.fieldAgent,Name for user role Field Agent,Field Agent,Agent de terrain +userRole.healthcareWorker,Name for user role Healthcare Worker,Healthcare Worker,Personnel de santé +userRole.localLeader,Name for user role Local Leader,Local Leader,Leader local +userRole.localRegistrar,Name for user role Local Registrar,Local Registrar,Registraire local +userRole.localSystemAdmin,Name for user role Local System Admin,Local System Admin,Administrateur système local +userRole.nationalRegistrar,Name for user role National Registrar,National Registrar,Registraire national +userRole.nationalSystemAdmin,Name for user role National System Admin,National System Admin,Administrateur système national +userRole.performanceManager,Name for user role Performance Manager,Performance Manager,Gestion des performances +userRole.policeOfficer,Name for user role Police Officer,Police Officer,Officier de police +userRole.registrationAgent,Name for user role Registration Agent,Registration Agent,Agent d'enregistrement +userRole.socialWorker,Name for user role Social Worker,Social Worker,Travailleur social userSetup.complete.instruction,Instruction for the setup complete,Login to your account with your username and newly created password,Connectez-vous maintenant à votre compte avec votre nom d'utilisateur et votre mot de passe nouvellement créé. userSetup.complete.title,Title for the setup complete page,Account setup complete,Configuration du compte terminée userSetup.instruction,User setup review page instruction,Check the details below to confirm your account details are correct,Vérifiez les détails ci-dessous pour confirmer que les détails de votre compte sont corrects. et faites les changements nécessaires pour confirmer que les détails de votre compte sont corrects. diff --git a/src/upgrade-to-1_7.ts b/src/upgrade-to-1_7.ts new file mode 100644 index 000000000..0e780488e --- /dev/null +++ b/src/upgrade-to-1_7.ts @@ -0,0 +1,367 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ +import { createReadStream, rmdirSync, writeFileSync } from 'fs' +import { camelCase, snakeCase } from 'lodash' +import { join } from 'path' +import { logger } from './logger' +import { stringify } from 'csv-stringify/sync' +import fs from 'fs' +import csv2json from 'csv2json' +import { inspect } from 'util' +import { format, resolveConfig } from 'prettier' + +/* + * inlining these two functions to not + * trigger envalid when running the script + */ +async function writeJSONToCSV( + filename: string, + data: Array> +) { + const csv = stringify(data, { + header: true + }) + return fs.promises.writeFile(filename, csv, 'utf8') +} + +async function readCSVToJSON(filename: string) { + return new Promise((resolve, reject) => { + const chunks: string[] = [] + createReadStream(filename) + .on('error', reject) + .pipe( + csv2json({ + separator: ',' + }) + ) + .on('data', (chunk) => chunks.push(chunk)) + .on('error', reject) + .on('end', () => { + resolve(JSON.parse(chunks.join(''))) + }) + }) +} + +const DEFAULT_ROLE_SCOPES_PRE_1_7 = { + FIELD_AGENT: `[ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_SUBMIT_INCOMPLETE, + SCOPES.RECORD_SUBMIT_FOR_REVIEW, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ]`, + REGISTRATION_AGENT: `[ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_APPROVAL, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ]`, + LOCAL_REGISTRAR: `[ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_REVIEW_DUPLICATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.REGISTER, + SCOPES.RECORD_REGISTRATION_CORRECT, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_UNASSIGN_OTHERS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.RECORD_CONFIRM_REGISTRATION, + SCOPES.RECORD_REJECT_REGISTRATION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PROFILE_ELECTRONIC_SIGNATURE, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ]`, + LOCAL_SYSTEM_ADMIN: `[ + SCOPES.USER_READ_MY_OFFICE, + SCOPES.USER_CREATE_MY_JURISDICTION, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS + ]`, + NATIONAL_SYSTEM_ADMIN: `[ + SCOPES.USER_CREATE, + SCOPES.USER_READ, + SCOPES.USER_UPDATE, + SCOPES.ORGANISATION_READ_LOCATIONS, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS, + SCOPES.CONFIG_UPDATE_ALL + ]`, + PERFORMANCE_MANAGEMENT: `[ + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS + ]`, + NATIONAL_REGISTRAR: `[ + SCOPES.RECORD_DECLARE_BIRTH, + SCOPES.RECORD_DECLARE_DEATH, + SCOPES.RECORD_DECLARE_MARRIAGE, + SCOPES.RECORD_DECLARATION_EDIT, + SCOPES.RECORD_SUBMIT_FOR_UPDATES, + SCOPES.RECORD_REVIEW_DUPLICATES, + SCOPES.RECORD_DECLARATION_ARCHIVE, + SCOPES.RECORD_DECLARATION_REINSTATE, + SCOPES.REGISTER, + SCOPES.RECORD_REGISTRATION_CORRECT, + SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS, + SCOPES.RECORD_EXPORT_RECORDS, + SCOPES.RECORD_UNASSIGN_OTHERS, + SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES, + SCOPES.RECORD_CONFIRM_REGISTRATION, + SCOPES.RECORD_REJECT_REGISTRATION, + SCOPES.PERFORMANCE_READ, + SCOPES.PERFORMANCE_READ_DASHBOARDS, + SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS, + SCOPES.PROFILE_ELECTRONIC_SIGNATURE, + SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE, + SCOPES.USER_READ_MY_OFFICE, + SCOPES.SEARCH_BIRTH, + SCOPES.SEARCH_DEATH, + SCOPES.SEARCH_MARRIAGE + ]` +} as const + +const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom') + +class FormattedScopes { + scopes: string + constructor(scopes: string) { + this.scopes = scopes + } + [customInspectSymbol]() { + return this.scopes + } +} + +async function main() { + await upgradeRolesDefinitions() +} + +async function upgradeRolesDefinitions() { + const roles = await readCSVToJSON( + join(__dirname, './src/data-seeding/roles/source/roles.csv') + ).catch((err) => { + if (err.code === 'ENOENT') { + logger.warn( + 'data-seeding/roles/source/roles.csv does not exist in the codebase. Looks like this codebase has been upgraded already.' + ) + } + + process.exit(1) + }) + + const rolesWithGeneratedIds = roles.map((role) => ({ + id: snakeCase(role.label_en).toUpperCase(), + label: { + defaultMessage: role.label_en, + description: `Name for user role ${role.label_en}`, + id: `userRole.${camelCase(role.label_en)}` + }, + oldLabels: Object.fromEntries( + Object.keys(role) + .filter((key) => key.startsWith('label_')) + .map((key) => [key.split('_')[1], role[key]]) + ), + systemRole: role.systemRole, + scopes: + DEFAULT_ROLE_SCOPES_PRE_1_7[ + role.systemRole as keyof typeof DEFAULT_ROLE_SCOPES_PRE_1_7 + ] + })) + + /* + * Add language items to src/translations/client.csv + */ + const copy = await readCSVToJSON( + join(__dirname, './src/translations/client.csv') + ) + + rolesWithGeneratedIds.forEach((role) => { + if (copy.find((item) => item.id === role.label.id)) { + logger.warn( + `Skipping role ${role.id} as it already exists in the client.csv` + ) + return + } + const copyItem = { + id: role.label.id, + description: role.label.description, + ...role.oldLabels + } + logger.info( + `Adding language items for role ${role.id}: ${JSON.stringify(copyItem)}` + ) + copy.push(copyItem) + }) + + /* + * Fix role references in default-employees.csv & prod-employees.csv from "National System Admin" to "NATIONAL_SYSTEM_ADMIN" + */ + + const defaultEmployees = await readCSVToJSON( + join(__dirname, './src/data-seeding/employees/source/default-employees.csv') + ) + + const defaultEmployeesWithRoles = defaultEmployees.map( + ({ systemRole, ...employee }) => { + if (!systemRole) { + logger.warn( + `Skipping employee "${employee.givenNames} ${employee.familyName}" as it already seems to have been migrated` + ) + return employee + } + const role = rolesWithGeneratedIds.find( + (role) => role.oldLabels.en === employee.role + ) + if (!role) { + logger.error(`Role with id ${employee.role} not found in roles.csv`) + process.exit(1) + } + return { + ...employee, + role: role.id + } + } + ) + + let prodEmployeesWithRoles = null + + try { + const prodEmployees = await readCSVToJSON( + join(__dirname, './src/data-seeding/employees/source/prod-employees.csv') + ) + + prodEmployeesWithRoles = prodEmployees.map( + ({ systemRole, ...employee }) => { + if (!systemRole) { + logger.warn( + `Skipping employee "${employee.givenNames} ${employee.familyName}" as it already seems to have been migrated` + ) + return employee + } + const role = rolesWithGeneratedIds.find( + (role) => role.oldLabels.en === employee.role + ) + if (!role) { + logger.error(`Role with id ${employee.role} not found in roles.csv`) + process.exit(1) + } + return { + ...employee, + role: role.id + } + } + ) + } catch (err) { + if (err.code === 'ENOENT') { + logger.warn( + './src/data-seeding/employees/source/prod-employees.csv does not exist in the codebase. Skipping' + ) + } + } + + /* + * Create the new "roles.ts" file with the updated roles and new format + */ + + const rolesWithoutDeprecatedFields = rolesWithGeneratedIds.map((role) => { + const { oldLabels, systemRole, ...rest } = role + return rest + }) + + const formattedRoles = rolesWithoutDeprecatedFields.map((role) => { + return { + ...role, + scopes: new FormattedScopes(role.scopes) + } + }) + + /* + * Persist changes + */ + logger.info('Creating roles file') + writeFileSync( + join(__dirname, './src/data-seeding/roles/roles.ts'), + await format( + ` + import { SCOPES, Scope } from '@opencrvs/toolkit/scopes' + import { MessageDescriptor } from 'react-intl' + + type Role = { + id: string + label: MessageDescriptor + scopes: Scope[] + } + + export const roles: Role[] = ${inspect(formattedRoles, { depth: null })} + `, + { + ...(await resolveConfig(__dirname)), + parser: 'babel-ts' + } + ) + ) + + logger.info('Updating copy file') + await writeJSONToCSV(join(__dirname, './src/translations/client.csv'), copy) + + logger.info('Updating default employees file') + await writeJSONToCSV( + join( + __dirname, + './src/data-seeding/employees/source/default-employees.csv' + ), + defaultEmployeesWithRoles + ) + if (prodEmployeesWithRoles) { + logger.info('Updating prod employees file') + await writeJSONToCSV( + join(__dirname, './src/data-seeding/employees/source/prod-employees.csv'), + prodEmployeesWithRoles + ) + } + + logger.info('Removing old roles file') + rmdirSync(join(__dirname, './src/data-seeding/roles/source'), { + recursive: true + }) +} + +main() diff --git a/src/utils/index.ts b/src/utils/index.ts index 941eeda1a..aedbb968a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -22,8 +22,7 @@ export const CHILD_CODE = 'child-details' export const DECEASED_CODE = 'deceased-details' export const OPENCRVS_SPECIFICATION_URL = 'http://opencrvs.org/specs/' import { join } from 'path' -import { promisify } from 'util' -import { stringify, Options } from 'csv-stringify' +import { stringify } from 'csv-stringify/sync' export interface ILocation { id?: string @@ -164,12 +163,11 @@ export async function updateResourceInHearth(resource: fhir.ResourceBase) { return res.text() } -const csvStringify = promisify>, Options>(stringify) export async function writeJSONToCSV( filename: string, data: Array> ) { - const csv = await csvStringify(data, { + const csv = stringify(data, { header: true }) return fs.promises.writeFile(filename, csv, 'utf8') diff --git a/tsconfig.json b/tsconfig.json index 12cb72786..34a6186db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "module": "Node16", "outDir": "build/dist", "sourceMap": true, + "resolveJsonModule": true, "moduleResolution": "node16", "rootDir": ".", "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022"], diff --git a/yarn.lock b/yarn.lock index feca1ff26..42a37ad16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,16 +790,21 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/toolkit@0.0.19-events-ml": - version "0.0.19-events-ml" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.19-events-ml.tgz#d93a4ed889908be0f0fd8a88b60640c807d74554" - integrity sha512-16TISLgkYpyrUUVpHtDqLjPhyPT21zPenGrj4UKKKjXt6J55t/y7Te6XXKK5jqsT0+i+VKlx2vVg3/BnSapVZA== +"@opencrvs/toolkit@0.0.22-scopes": + version "0.0.22-scopes" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.22-scopes.tgz#282e577cb6c12226472f113d8753c7fbe1b150e7" + integrity sha512-VLJSgOuoR10SJPVY9EumbeMqQyuRJRNhMoUEA7O4CafGnj3PsYbawNF44qb5VLe3eJ4uEwAPnZXVBU7BGWRz9w== dependencies: "@trpc/client" "^11.0.0-rc.648" "@trpc/server" "^11.0.0-rc.532" ajv "^8.17.1" superjson "1.9.0-0" +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== + "@rollup/rollup-android-arm-eabi@4.24.0": version "4.24.0" resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz#1661ff5ea9beb362795304cb916049aba7ac9c54" @@ -1153,10 +1158,12 @@ dependencies: undici-types "~5.25.1" -"@types/node@^10.12.5": - version "10.17.60" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" - integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== +"@types/node@^18.19.1": + version "18.19.68" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.68.tgz#f4f10d9927a7eaf3568c46a6d739cc0967ccb701" + integrity sha512-QGtpFH1vB99ZmTa63K4/FU8twThj4fuVSBkGddTp7uIL/cuoLWIUSL2RcOaigBhfR+hg5pgGkBnkoOxrTVBMKw== + dependencies: + undici-types "~5.26.4" "@types/node@^20.9.0": version "20.11.5" @@ -2299,17 +2306,18 @@ escape-string-regexp@^5.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== -eslint-config-prettier@^8.8.0: - version "8.8.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.8.0.tgz#bfda738d412adc917fd7b038857110efe98c9348" - integrity sha512-wLbQiFre3tdGgpDv67NQKnJuTlcUVYHas3k+DZCc2U2BadthoEY4B7hLPvAxaqdyOGCzuLfii2fqGph10va7oA== +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== -eslint-plugin-prettier@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b" - integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ== +eslint-plugin-prettier@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95" + integrity sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw== dependencies: prettier-linter-helpers "^1.0.0" + synckit "^0.9.1" eslint-scope@^5.1.1: version "5.1.1" @@ -4240,10 +4248,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.8.8: - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier@^3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.4.2.tgz#a5ce1fb522a588bf2b78ca44c6e6fe5aa5a2b13f" + integrity sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ== pretty-format@^23.6.0: version "23.6.0" @@ -4986,6 +4994,14 @@ symbol-observable@^1.1.0: resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== + dependencies: + "@pkgr/core" "^0.1.0" + tslib "^2.6.2" + text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -5111,7 +5127,7 @@ tsconfig-paths@^3.8.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2: +tslib@2, tslib@^2.6.2: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== From 7f52bad3ca62ba3732069eafc5a75b7ab2ea7341 Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Thu, 23 Jan 2025 18:47:56 +0600 Subject: [PATCH 5/8] chore: update translations --- src/translations/client.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/translations/client.csv b/src/translations/client.csv index aaf5796ad..b8609eae0 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -199,7 +199,6 @@ config.emailAllUsers.modal.title,Label for send email all users confirmation tit config.emailAllUsers.subtitle,Subtitle for email all users,This email will be sent to all users you are active. Emails will be sent over the next 24 hours. Only one email can be sent per day,Cet e-mail sera envoyé à tous les utilisateurs que vous activez. Les courriels seront envoyés au cours des prochaines 24 heures. Un seul courriel peut être envoyé par jour config.emailAllUsers.title,Title for email all users,Email all users,Envoyer un e-mail à tous les utilisateurs config.userRoles.language,Language name,"{language, select, en {English} fr {French} other {{language}}}","{language, select, en {Anglais} fr {Français} other {{language}}}" -config.userRoles.roleUpdateInstruction,Instruction for adding/updating role in role management modal,Add the roles to be assigned the system role of {systemRole},Ajoutez les rôles auxquels attribuer le rôle système de {systemRole} conflicts.modal.assign.description,Description for modal when assign,Please note you will have sole access to this record. Please make any updates promptly otherwise unassign the record.,"Veuillez noter que vous aurez un accès exclusif à cet enregistrement. Veuillez effectuer rapidement les mises à jour éventuelles, sinon vous désassignez l'enregistrement." conflicts.modal.assign.title,Title for modal when assign,Assign record?,Attribuer un enregistrement ? conflicts.modal.assigned.description,Description for modal when record already assigned,{name} at {officeName} has sole editable access to this record,{name} à {officeName} a un accès unique et modifiable à cet enregistrement. @@ -1387,6 +1386,7 @@ integrations.shaSecret,Label for SHA secret,SHA secret,SHA Secret integrations.supportingDescription,,Supporting description to help user make a decision and navigate the content,Description complémentaire pour aider l'utilisateur à prendre une décision et à naviguer dans le contenu. integrations.type.eventNotification,Label for event notification,Event notification,Notification d'événement integrations.type.healthSystem,Label for health system type,Health integration,Intégration de la santé +integrations.type.nationalId,Label for national id,National id,Identité nationale integrations.type.recordSearch,Label for record search,Record search,Recherche d'enregistrements integrations.type.webhook,Label for web hook,Webhook,Webhook integrations.uniqueKeyDescription,Label for the unique key description,These unique keys will be required by the client integrating...,Ces clés uniques seront requises par l'interface du système @@ -1687,6 +1687,7 @@ navigation.emailAllUsers,Email all users label in navigation,Email all users,Env navigation.informantNotification,Informant notifications label in navigation,Informant notifications,Notifications des informateurs navigation.integration,Integration forms label in navigation,Integrations,Intégrations navigation.leaderboards,Leaderboards Dashboard Section,Leaderboards,Classements +navigation.my-drafts,My drafts label in navigation,My drafts,Mes projets navigation.organisation,Organisations label in navigation,Organisation,Organisation navigation.outbox,Label for navigation item outbox,Outbox,Boîte d'envoi navigation.performance,Performance label in navigation,Performance,Performance From 289a0e9f86ae937cbb38e49c3c0fc15a3af5e5e2 Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Mon, 30 Dec 2024 15:32:59 +0600 Subject: [PATCH 6/8] chore: change in-progress to my-drafts --- .../birth/1-birth-event-declaration.spec.ts | 12 ++++++------ .../death/1-death-event-declaration.spec.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/e2e/testcases/birth/1-birth-event-declaration.spec.ts b/e2e/testcases/birth/1-birth-event-declaration.spec.ts index 78426dfaf..69335fbcc 100644 --- a/e2e/testcases/birth/1-birth-event-declaration.spec.ts +++ b/e2e/testcases/birth/1-birth-event-declaration.spec.ts @@ -426,10 +426,10 @@ test.describe('1. Birth event declaration', () => { /* * Expected result: should - * - be navigated to "in-progress" tab + * - be navigated to "my-drafts" tab * - find the declared birth event record on this page list with saved data */ - await expect(page.locator('#content-name')).toHaveText('In progress') + await expect(page.locator('#content-name')).toHaveText('My drafts') await expect(page.getByText(/seconds ago/)).toBeVisible() }) }) @@ -483,13 +483,13 @@ test.describe('1. Birth event declaration', () => { test('1.10.3 Click Confirm', async ({ page }) => { await page.getByRole('button', { name: 'Confirm' }).click() /* - * Expected result: should be navigated to "in-progress" tab but no draft will be saved + * Expected result: should be navigated to "my-drafts" tab but no draft will be saved */ await page.waitForTimeout(500) // This page renders twice at first await expect( - page.locator('#content-name', { hasText: 'In progress' }) + page.locator('#content-name', { hasText: 'My drafts' }) ).toBeVisible() await expect(page.getByText(/seconds ago/)).toBeHidden() }) @@ -552,13 +552,13 @@ test.describe('1. Birth event declaration', () => { await page.getByRole('button', { name: 'Confirm' }).click() /* - * Expected result: should be navigated to "in-progress" tab but no draft will be saved + * Expected result: should be navigated to "my-drafts" tab but no draft will be saved */ await page.waitForTimeout(500) // This page renders twice at first await expect( - page.locator('#content-name', { hasText: 'In progress' }) + page.locator('#content-name', { hasText: 'My drafts' }) ).toBeVisible() await expect(page.getByText(/seconds ago/)).toBeHidden() }) diff --git a/e2e/testcases/death/1-death-event-declaration.spec.ts b/e2e/testcases/death/1-death-event-declaration.spec.ts index 1f9d2e9c5..dfc7e8d54 100644 --- a/e2e/testcases/death/1-death-event-declaration.spec.ts +++ b/e2e/testcases/death/1-death-event-declaration.spec.ts @@ -406,10 +406,10 @@ test.describe('1. Death event declaration', () => { /* * Expected result: should - * - be navigated to "in-progress" tab + * - be navigated to "my-drafts" tab * - find the declared death event record on this page list with saved data */ - await expect(page.locator('#content-name')).toHaveText('In progress') + await expect(page.locator('#content-name')).toHaveText('My drafts') await expect(page.getByText(/seconds ago/)).toBeVisible() }) }) @@ -463,13 +463,13 @@ test.describe('1. Death event declaration', () => { test('1.10.3 Click Confirm', async ({ page }) => { await page.getByRole('button', { name: 'Confirm' }).click() /* - * Expected result: should be navigated to "in-progress" tab but no draft will be saved + * Expected result: should be navigated to "my-drafts" tab but no draft will be saved */ await page.waitForTimeout(500) // This page renders twice at first await expect( - page.locator('#content-name', { hasText: 'In progress' }) + page.locator('#content-name', { hasText: 'My drafts' }) ).toBeVisible() await expect(page.getByText(/seconds ago/)).toBeHidden() }) @@ -532,13 +532,13 @@ test.describe('1. Death event declaration', () => { await page.getByRole('button', { name: 'Confirm' }).click() /* - * Expected result: should be navigated to "in-progress" tab but no draft will be saved + * Expected result: should be navigated to "my-drafts" tab but no draft will be saved */ await page.waitForTimeout(500) // This page renders twice at first await expect( - page.locator('#content-name', { hasText: 'In progress' }) + page.locator('#content-name', { hasText: 'My drafts' }) ).toBeVisible() await expect(page.getByText(/seconds ago/)).toBeHidden() }) From 0110af63bd2504b0c5f1e0e97c691d48fcca1802 Mon Sep 17 00:00:00 2001 From: "Md. Ashikul Alam" Date: Fri, 10 Jan 2025 19:08:27 +0600 Subject: [PATCH 7/8] fix: update fetch registration queries --- e2e/testcases/birth/queries.ts | 52 ++++++++++++++++++++++++++++++---- e2e/testcases/death/queries.ts | 47 ++++++++++++++++++++++++++---- 2 files changed, 89 insertions(+), 10 deletions(-) diff --git a/e2e/testcases/birth/queries.ts b/e2e/testcases/birth/queries.ts index b4c30bc7d..b14dd2f87 100644 --- a/e2e/testcases/birth/queries.ts +++ b/e2e/testcases/birth/queries.ts @@ -150,6 +150,31 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql` contactRelationship contactPhoneNumber contactEmail + assignment { + practitionerId + firstName + lastName + officeName + avatarURL + } + certificates { + hasShowedVerifiedDocument + certificateTemplateId + collector { + relationship + otherRelationship + name { + use + firstNames + familyName + } + telecom { + system + value + use + } + } + } duplicates { compositionId trackingId @@ -207,6 +232,7 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql` requesterOther noSupportingDocumentationRequired hasShowedVerifiedDocument + certificateTemplateId date action regStatus @@ -250,13 +276,13 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql` user { id role { - _id - labels { - lang - label + id + label { + id + defaultMessage + description } } - systemRole name { firstNames familyName @@ -295,6 +321,7 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql` } certificates { hasShowedVerifiedDocument + certificateTemplateId collector { relationship otherRelationship @@ -309,6 +336,21 @@ export const GET_BIRTH_REGISTRATION_FOR_REVIEW = print(gql` use } } + certifier { + name { + use + firstNames + familyName + } + role { + id + label { + id + defaultMessage + description + } + } + } } duplicateOf potentialDuplicates diff --git a/e2e/testcases/death/queries.ts b/e2e/testcases/death/queries.ts index 52eb3734b..d994b913d 100644 --- a/e2e/testcases/death/queries.ts +++ b/e2e/testcases/death/queries.ts @@ -214,6 +214,24 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql` contactRelationship contactPhoneNumber contactEmail + certificates { + hasShowedVerifiedDocument + certificateTemplateId + collector { + relationship + otherRelationship + name { + use + firstNames + familyName + } + telecom { + system + value + use + } + } + } duplicates { compositionId trackingId @@ -287,7 +305,9 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql` } otherReason requester + requesterOther hasShowedVerifiedDocument + certificateTemplateId noSupportingDocumentationRequired date action @@ -318,13 +338,14 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql` user { id role { - _id - labels { - lang - label + id + label { + id + defaultMessage + description } } - systemRole + name { firstNames familyName @@ -363,6 +384,7 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql` } certificates { hasShowedVerifiedDocument + certificateTemplateId collector { relationship otherRelationship @@ -377,6 +399,21 @@ export const GET_DEATH_REGISTRATION_FOR_REVIEW = print(gql` use } } + certifier { + name { + use + firstNames + familyName + } + role { + id + label { + id + defaultMessage + description + } + } + } } duplicateOf potentialDuplicates From 1ade8e5a388c1c8159b2ca73609ce152d4285b73 Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Thu, 23 Jan 2025 19:06:33 +0600 Subject: [PATCH 8/8] chore: revert certificate changes --- .../birth-certificate-certified-copy.svg | 24 ++++------------ .../certificates/source/birth-certificate.svg | 28 ++++++------------- .../death-certificate-certified-copy.svg | 18 ++---------- .../certificates/source/death-certificate.svg | 18 ++---------- .../marriage-certificate-certified-copy.svg | 18 ++---------- .../source/marriage-certificate.svg | 18 ++---------- 6 files changed, 22 insertions(+), 102 deletions(-) diff --git a/src/api/certificates/source/birth-certificate-certified-copy.svg b/src/api/certificates/source/birth-certificate-certified-copy.svg index bb9f23bfa..f6ed4acb4 100644 --- a/src/api/certificates/source/birth-certificate-certified-copy.svg +++ b/src/api/certificates/source/birth-certificate-certified-copy.svg @@ -14,12 +14,12 @@ Place of certification / Lieu de certification - + Certified by: {{registrar.name}} @@ -317,22 +317,7 @@ {{ registrar.name }} - - - - - - - - - - - - - - - @@ -394,8 +379,9 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file + diff --git a/src/api/certificates/source/birth-certificate.svg b/src/api/certificates/source/birth-certificate.svg index 2a9793f08..5a62836b3 100644 --- a/src/api/certificates/source/birth-certificate.svg +++ b/src/api/certificates/source/birth-certificate.svg @@ -48,12 +48,16 @@ Place of certification / Lieu de délivrance - + {{#ifCond mosipAid '===' undefined }} + + {{else}} + {{mosipAIDLabel}} + {{/ifCond}} + @@ -241,22 +245,7 @@ - - - - - - - - - - - - - - - @@ -297,8 +286,9 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file + diff --git a/src/api/certificates/source/death-certificate-certified-copy.svg b/src/api/certificates/source/death-certificate-certified-copy.svg index 27cc4b114..efebe5d56 100644 --- a/src/api/certificates/source/death-certificate-certified-copy.svg +++ b/src/api/certificates/source/death-certificate-certified-copy.svg @@ -234,22 +234,7 @@ - - - - - - - - - - - - - - - @@ -293,8 +278,9 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file + diff --git a/src/api/certificates/source/death-certificate.svg b/src/api/certificates/source/death-certificate.svg index 68df6ebd4..50cc356c2 100644 --- a/src/api/certificates/source/death-certificate.svg +++ b/src/api/certificates/source/death-certificate.svg @@ -214,22 +214,7 @@ CERTIFICATE OF DEATH / ACTE DE DEATH - - - - - - - - - - - - - - - @@ -267,8 +252,9 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file + diff --git a/src/api/certificates/source/marriage-certificate-certified-copy.svg b/src/api/certificates/source/marriage-certificate-certified-copy.svg index 0d204c59d..268392ea2 100644 --- a/src/api/certificates/source/marriage-certificate-certified-copy.svg +++ b/src/api/certificates/source/marriage-certificate-certified-copy.svg @@ -311,22 +311,7 @@ - - - - - - - - - - - - - - - @@ -388,8 +373,9 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file + diff --git a/src/api/certificates/source/marriage-certificate.svg b/src/api/certificates/source/marriage-certificate.svg index bcd4927a0..a66d82068 100644 --- a/src/api/certificates/source/marriage-certificate.svg +++ b/src/api/certificates/source/marriage-certificate.svg @@ -217,22 +217,7 @@ - - - - - - - - - - - - - - - @@ -273,10 +258,11 @@ + {{#ifCond printInAdvance '!==' true}} {{/ifCond}} - \ No newline at end of file +