From 58c1191a4b8411e05f5cf6a06c36292281e616ce Mon Sep 17 00:00:00 2001 From: jamil314 Date: Tue, 5 Nov 2024 15:01:26 +0600 Subject: [PATCH 01/32] fix: reset metabase on deploy --- infrastructure/deployment/deploy.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index 34d966be8..f63f14c50 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -299,6 +299,13 @@ docker_stack_deploy() { docker stack deploy --prune -c '$(split_and_join " " " -c " "$(to_remote_paths $COMPOSE_FILES_USED)")' --with-registry-auth opencrvs' } +reset_metabase() { + echo "Reseting metabase" + configured_ssh 'docker service scale opencrvs_dashboards=0 && \ + sudo rm /data/metabase/metabase.mv.db && \ + docker service scale opencrvs_dashboards=1' +} + validate_options # Create new passwords for all MongoDB users created in @@ -413,6 +420,8 @@ EMAIL_PAYLOAD='{ "to": "{{ALERT_EMAIL}}" }' +reset_metabase + configured_ssh "docker run --rm --network=opencrvs_overlay_net appropriate/curl \ -X POST 'http://countryconfig:3040/email' \ -H 'Content-Type: application/json' \ From 97d7ba1b963f86293feee83afd8ddf4c5021ce92 Mon Sep 17 00:00:00 2001 From: jamil314 Date: Tue, 5 Nov 2024 17:56:06 +0600 Subject: [PATCH 02/32] fix: remove metabase.mv.db from docker container --- infrastructure/deployment/deploy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index f63f14c50..1f8568850 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -301,9 +301,9 @@ docker_stack_deploy() { reset_metabase() { echo "Reseting metabase" - configured_ssh 'docker service scale opencrvs_dashboards=0 && \ - sudo rm /data/metabase/metabase.mv.db && \ - docker service scale opencrvs_dashboards=1' + configured_ssh "docker exec \$(docker ps | grep opencrvs_dashboards | awk '{print \$1}' | head -n 1) /bin/sh -c \"rm /data/metabase/metabase.mv.db\" && \ + docker service scale opencrvs_dashboards=0 && \ + docker service scale opencrvs_dashboards=1" } validate_options From 4169f76f81a4cd0f557314f8e87b64764eb1e407 Mon Sep 17 00:00:00 2001 From: jamil314 Date: Thu, 7 Nov 2024 12:47:17 +0600 Subject: [PATCH 03/32] fix: only reset metabase when opencrvs core version is changed --- infrastructure/deployment/deploy.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index 1f8568850..ffe744b9b 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -299,6 +299,12 @@ docker_stack_deploy() { docker stack deploy --prune -c '$(split_and_join " " " -c " "$(to_remote_paths $COMPOSE_FILES_USED)")' --with-registry-auth opencrvs' } +get_opencrvs_version() { + PREVIOUS_VERSION=$(configured_ssh "docker service ls | grep opencrvs_base | cut -d ':' -f 2") + echo "Previous opencrvs version: $PREVIOUS_VERSION" + echo "Current opencrvs version: $VERSION" +} + reset_metabase() { echo "Reseting metabase" configured_ssh "docker exec \$(docker ps | grep opencrvs_dashboards | awk '{print \$1}' | head -n 1) /bin/sh -c \"rm /data/metabase/metabase.mv.db\" && \ @@ -308,6 +314,8 @@ reset_metabase() { validate_options +get_opencrvs_version + # Create new passwords for all MongoDB users created in # infrastructure/mongodb/docker-entrypoint-initdb.d/create-mongo-users.sh # @@ -420,7 +428,14 @@ EMAIL_PAYLOAD='{ "to": "{{ALERT_EMAIL}}" }' -reset_metabase +VERSION=$(echo "$VERSION" | xargs) +PREVIOUS_VERSION=$(echo "$PREVIOUS_VERSION" | xargs) + +if [[ "$VERSION" == "$PREVIOUS_VERSION" ]]; then + echo "No reset needed for Metabase." +else + reset_metabase +fi configured_ssh "docker run --rm --network=opencrvs_overlay_net appropriate/curl \ -X POST 'http://countryconfig:3040/email' \ From bf5cc70aacbcd1a6324359f6c5e269e3f959c4ad Mon Sep 17 00:00:00 2001 From: PathumN99 Date: Fri, 8 Nov 2024 17:05:47 +0530 Subject: [PATCH 04/32] chore: cleaned up the national ID integration code --- src/translations/client.csv | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/translations/client.csv b/src/translations/client.csv index 67b79213f..40e79c0c4 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -1348,7 +1348,6 @@ integrations.name,Label for name input,Name,Nom integrations.nationalIDName,Label for name input for National ID,Name,Nom integrations.nationalidAlertDescription,,"A National ID client (eg. MOSIP) can react to birth or death webhooks to create or invalidate NID numbers, and respond to OpenCRVS to provide a temporary ID to children, and link vital events to each other. For more information, visit:","Un client d'identification nationale (par exemple MOSIP) peut réagir aux webhooks de naissance ou de décès pour créer ou invalider des numéros d'identification nationale, et répondre à OpenCRVS pour fournir une identification temporaire aux enfants, et relier les événements d'état civil entre eux. Pour plus d'informations, visitez le site :" integrations.newIntegrationDescription,Description to help user fill name and type of a new integration client,Add a unique name and select the type of client you would like to create,Ajoutez un nom unique et sélectionnez le type de client que vous souhaitez créer -integrations.onlyOneNationalId,,Only one National ID integration is allowed.,Une seule intégration d'identité nationale est autorisée integrations.otherAlertDescription,,...Please visit,...Veuillez visiter integrations.pageIntroduction,Label for the text integration page intorduction,"For each new client that needs to integrate with OpenCRVS you can create unique client IDs. A number of integration use cases are currently supported, based on both API and webhook technologies.","Pour chaque nouveau client qui doit s'intégrer à OpenCRVS, vous pouvez créer des identifiants client uniques. Un certain nombre de cas d'utilisation de l'intégration sont actuellement pris en charge, sur la base des technologies API et webhook" integrations.pageTitle,Title for integrations page,Integrations,Intégrations @@ -1359,7 +1358,6 @@ 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 system client,National ID,Carte d'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 From 733b69dc85512292b7b548ee2d69ee302ee50f64 Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Fri, 15 Nov 2024 10:36:23 +0200 Subject: [PATCH 05/32] Always retry mongo-on-update on failure (#320) --- CHANGELOG.md | 2 ++ infrastructure/docker-compose.deploy.yml | 5 ++++- infrastructure/server-setup/tasks/swap.yml | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5362eeb0..3fc0ffc90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ - "Publish release" pipeline now correctly uses the "Branch to build from" value as the branch to be tagged. Previously it tried tagging "master". "Release tag" is also now used as the release version as is instead of it being read from `package.json`. - Backup process now doesn't require internet connection to download docker images thus working more reliably when internet connections are unreliable. Previously non-active images were cleaned nightly, now we only do it as part of deployment. [#7896](https://github.com/opencrvs/opencrvs-core/issues/7896) - We make sure that the automatic cleanup job only runs before deployment (instead of cron schedule cleanup). +- Previously it was possible MongoDB replica set and users were left randomly uninitialised after a deployment. MongoDB initialisation container now retries on failure. +- On some machines 'file' utility was not preinstalled causing provision to fail. We now install the utility if it doesn't exist. ### Breaking changes diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 682c32100..4252ba241 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -226,8 +226,11 @@ services: labels: - traefik.enable=false replicas: 1 + # If this doesn't get run successfully, both the replica set in mongo and + # the user schema remains uninitialized. restart_policy: - condition: none + condition: on-failure + delay: 10s environment: - REPLICAS=1 - MONGODB_ADMIN_USER=${MONGODB_ADMIN_USER} diff --git a/infrastructure/server-setup/tasks/swap.yml b/infrastructure/server-setup/tasks/swap.yml index 9c732e3e7..08f6407b2 100644 --- a/infrastructure/server-setup/tasks/swap.yml +++ b/infrastructure/server-setup/tasks/swap.yml @@ -14,6 +14,13 @@ tags: - swap.file.permissions +- name: Ensure 'file' utility is installed + ansible.builtin.package: + name: file + state: present + tags: + - swap.file.mkswap + - name: 'Check swap file type' command: file {{ swap_file_path }} register: swapfile From a74c8d05a9d3ea08f01324bd5afa9920ecd6fe65 Mon Sep 17 00:00:00 2001 From: Barry Dwyer Date: Wed, 20 Nov 2024 09:58:01 +0200 Subject: [PATCH 06/32] chore: Add initial value type to match types in core --- src/form/types/types.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/form/types/types.ts b/src/form/types/types.ts index 014dc3636..09eba2449 100644 --- a/src/form/types/types.ts +++ b/src/form/types/types.ts @@ -562,7 +562,7 @@ export interface IFormFieldBase { disabled?: boolean enabled?: string custom?: boolean - initialValue?: IFormFieldValue + initialValue?: InitialValue initialValueKey?: string extraValue?: IFormFieldValue conditionals?: Conditional[] @@ -838,6 +838,13 @@ export interface IDateRangePickerValue { isDateRangeActive: boolean | undefined } +export type DependencyInfo = { + expression: string + dependsOn: string[] +} + +export type InitialValue = IFormFieldValue | DependencyInfo + export type IFormFieldValue = | string | string[] From 1d3e670c3899b91e22df460b7eee713363258ac1 Mon Sep 17 00:00:00 2001 From: Euan Millar Date: Wed, 20 Nov 2024 08:50:47 +0000 Subject: [PATCH 07/32] fix: error in the farajaland birth certificate svg (#322) --- src/api/certificates/source/Farajaland-birth-certificate-v2.svg | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/certificates/source/Farajaland-birth-certificate-v2.svg b/src/api/certificates/source/Farajaland-birth-certificate-v2.svg index b645dc0a1..6910fa727 100644 --- a/src/api/certificates/source/Farajaland-birth-certificate-v2.svg +++ b/src/api/certificates/source/Farajaland-birth-certificate-v2.svg @@ -29,7 +29,6 @@ {{location loggedInUser.officeId 'name'}}
{{location loggedInUser.districtId 'name'}}, {{location loggedInUser.stateId 'name'}}, Farajaland Place of certification / Lieu de délivrance - From 5d30a77cd3b3f53dee2b94f610cfbf008b956ace Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 20 Nov 2024 17:22:01 +0600 Subject: [PATCH 08/32] Backup done --- infrastructure/server-setup/inventory/backup.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/infrastructure/server-setup/inventory/backup.yml b/infrastructure/server-setup/inventory/backup.yml index 41ab8e839..a456f2cf7 100644 --- a/infrastructure/server-setup/inventory/backup.yml +++ b/infrastructure/server-setup/inventory/backup.yml @@ -26,8 +26,18 @@ all: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true + - name: niko + ssh_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGy93egakrVxXHb9LafRQ7T0Cl+p+gCTuymLyofTLK2ncwKhOZ/uV5SuzaKb4lJbBnpmxNdvAxsYXff5srvJfrV0ZZXFQdAAg0mmWuXxrhNfaE52S4s6WVKknTqDE5PhMxzVxzynBnaTdW9Cno7mO+rnS/VybjZIadpOuv5Bek1PztBmrUi4h0Qg1PxXNmFqzyc1dsil1T0nFeu5cH59G5fF1/oSUlC6CYBNoHdQ62IBoydBwMumk/trFoTlxPNK1wXgcUvsr8Sa5A4lN2Rrc6Y22CEGwomtyjHb2kDVbI+7B1Zq+S89yyyvkPFezEsCdK/Ehaj8HzfcsR/bassSn0/Xv3bL20eh7wv7cnut40kFizYifNGfpEqPvSzjfJbB4iG2WSKkW8F9t0/cvd0AdY/3jB0vXhvnRvCqHm1X6JVdGamF3GJeHUMk9JDg3rQdT47BZUtSJer4MGWWcNiALjeWPNLXK9cAvrI/6GbHbPyTzACfR6nhs03Z/eebuvpp0= + state: present + sudoer: true + - name: shoumik + ssh_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + state: present + sudoer: true backups-host: hosts: - backup: # @todo set this to be the hostname of your backup server - ansible_host: '66.66.66.66' + shoumikland-backup: # @todo set this to be the hostname of your backup server + ansible_host: '5.223.45.193' From e2f467733ba4062334afefa11a42d92fd23e7e69 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 20 Nov 2024 17:24:46 +0600 Subject: [PATCH 09/32] QA done --- infrastructure/server-setup/inventory/qa.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/infrastructure/server-setup/inventory/qa.yml b/infrastructure/server-setup/inventory/qa.yml index d1247ebc0..3e6394c91 100644 --- a/infrastructure/server-setup/inventory/qa.yml +++ b/infrastructure/server-setup/inventory/qa.yml @@ -16,11 +16,20 @@ all: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true + - name: riku + ssh_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com + state: present + - name: shoumik + ssh_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + state: present + sudoer: true docker-manager-first: hosts: - qa: # @todo set this to be the hostname of your target server - ansible_host: '55.55.55.55' # @todo set this to be the IP address of your server + shoumikland-qa: # @todo set this to be the hostname of your target server + ansible_host: '5.223.51.253' # @todo set this to be the IP address of your server # ansible_port: '23' # @todo set this to be the SSH port if it's not 22 # internal_ssh_port: '22' # @todo if you are port-forwarding and server SSH port is not the same as ansible_port, set it here data_label: data1 # for manager machines, this should always be "data1" From 3359dd2d36f67ca6731839667d11b4b6e834bcdf Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 20 Nov 2024 17:34:29 +0600 Subject: [PATCH 10/32] all env done --- .../server-setup/inventory/backup.yml | 10 ++++---- .../server-setup/inventory/production.yml | 25 +++++++++++-------- infrastructure/server-setup/inventory/qa.yml | 6 +---- .../server-setup/inventory/staging.yml | 18 +++++++------ 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/infrastructure/server-setup/inventory/backup.yml b/infrastructure/server-setup/inventory/backup.yml index a456f2cf7..c3e91da7f 100644 --- a/infrastructure/server-setup/inventory/backup.yml +++ b/infrastructure/server-setup/inventory/backup.yml @@ -21,11 +21,6 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: my-user - ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com - state: present - sudoer: true - name: niko ssh_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGy93egakrVxXHb9LafRQ7T0Cl+p+gCTuymLyofTLK2ncwKhOZ/uV5SuzaKb4lJbBnpmxNdvAxsYXff5srvJfrV0ZZXFQdAAg0mmWuXxrhNfaE52S4s6WVKknTqDE5PhMxzVxzynBnaTdW9Cno7mO+rnS/VybjZIadpOuv5Bek1PztBmrUi4h0Qg1PxXNmFqzyc1dsil1T0nFeu5cH59G5fF1/oSUlC6CYBNoHdQ62IBoydBwMumk/trFoTlxPNK1wXgcUvsr8Sa5A4lN2Rrc6Y22CEGwomtyjHb2kDVbI+7B1Zq+S89yyyvkPFezEsCdK/Ehaj8HzfcsR/bassSn0/Xv3bL20eh7wv7cnut40kFizYifNGfpEqPvSzjfJbB4iG2WSKkW8F9t0/cvd0AdY/3jB0vXhvnRvCqHm1X6JVdGamF3GJeHUMk9JDg3rQdT47BZUtSJer4MGWWcNiALjeWPNLXK9cAvrI/6GbHbPyTzACfR6nhs03Z/eebuvpp0= @@ -36,6 +31,11 @@ all: - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 state: present sudoer: true + - name: riku + ssh_keys: + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com + state: present + sudoer: true backups-host: hosts: diff --git a/infrastructure/server-setup/inventory/production.yml b/infrastructure/server-setup/inventory/production.yml index 4176ff701..7cb5c8f35 100644 --- a/infrastructure/server-setup/inventory/production.yml +++ b/infrastructure/server-setup/inventory/production.yml @@ -30,16 +30,21 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: my-user + - name: riku ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com + state: present + sudoer: true + - name: shoumik + ssh_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 state: present sudoer: true docker-manager-first: hosts: - prod-01: # @todo set this to be the hostname of your target server - ansible_host: '22.22.22.22' # @todo set this to be the hostname of your target server + shoumikland-prod: # @todo set this to be the hostname of your target server + ansible_host: '5.223.47.240' # @todo set this to be the hostname of your target server data_label: data1 # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' # @todo set this to be the IP address of your jump server @@ -47,17 +52,17 @@ docker-manager-first: # @todo We recommend you add 2-4 workers for a scaled production deployment # This should depend on the size of your country and the number of end users. # If you are only using one production worker for very small countries or small pilot projects, replace with an empty block like so: docker-workers: {} -docker-workers: - hosts: - prod-02: # @todo set this to be the hostname of your target server - ansible_host: '33.33.33.33' +# docker-workers: +# hosts: +# prod-02: # @todo set this to be the hostname of your target server +# ansible_host: '33.33.33.33' # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' backups: hosts: - backup: # @todo set this to be the hostname of your backup server - ansible_host: '66.66.66.66' + shoumikland-backup: # @todo set this to be the hostname of your backup server + ansible_host: '5.223.45.193' # set this to be the IP address of your backup server # Written by provision pipeline. Assumes "backup" environment # exists in Github environments ansible_ssh_private_key_file: /tmp/backup_ssh_private_key diff --git a/infrastructure/server-setup/inventory/qa.yml b/infrastructure/server-setup/inventory/qa.yml index 3e6394c91..1ccd47fe2 100644 --- a/infrastructure/server-setup/inventory/qa.yml +++ b/infrastructure/server-setup/inventory/qa.yml @@ -11,15 +11,11 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: my-user - ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com - state: present - sudoer: true - name: riku ssh_keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com state: present + sudoer: true - name: shoumik ssh_keys: - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 diff --git a/infrastructure/server-setup/inventory/staging.yml b/infrastructure/server-setup/inventory/staging.yml index 50a6cb216..ecd002dff 100644 --- a/infrastructure/server-setup/inventory/staging.yml +++ b/infrastructure/server-setup/inventory/staging.yml @@ -32,16 +32,20 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: my-user + - name: riku ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com + state: present + sudoer: true + - name: shoumik + ssh_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 state: present sudoer: true - docker-manager-first: hosts: - staging: # @todo set this to be the hostname of your target server - ansible_host: '11.11.11.11' # @todo set this to be the hostname of your target server + shoumikland-staging: # @todo set this to be the hostname of your target server + ansible_host: '5.223.51.99' # @todo set this to be the hostname of your target server data_label: data1 # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' # @todo set this to be the IP address of your jump server @@ -53,8 +57,8 @@ docker-workers: {} # @todo if you do not intend to set up automatic sync from the backup server, you can remove this section. backups: hosts: - backup: # @todo set this to be the hostname of your backup server - ansible_host: '66.66.66.66' # set this to be the IP address of your backup server + shoumikland-backup: # @todo set this to be the hostname of your backup server + ansible_host: '5.223.45.193' # set this to be the IP address of your backup server # Written by provision pipeline. Assumes "backup" environment # exists in Github environments ansible_ssh_private_key_file: /tmp/backup_ssh_private_key From 72ec42cb51f369de03f84b7c3ccc6ab2be0fca65 Mon Sep 17 00:00:00 2001 From: Barry Dwyer Date: Wed, 20 Nov 2024 13:53:14 +0200 Subject: [PATCH 11/32] chore: update change log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc0ffc90..ffb315e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,6 +127,7 @@ INSERT CSV ROWS IN ENGLISH ONLY - Github pipeline dedicated for reading secrets and variables from other environments now checks if GH_TOKEN is still valid before attempting other operations - Remove unnecessary UI dividers that add in various sections of the declaration forms(e.g the Death, Birth and Marriage forms) [#244](https://github.com/opencrvs/opencrvs-countryconfig/pull/244) - Update template transformer for fields `informantType` and `otherInformantType` that fixes the bug of unavailability of these template fields [#5952](https://github.com/opencrvs/opencrvs-countryconfig/pull/5952) +- Fixed missing InitialValue property to set initial values based on an expression ## 1.5.2 (https://github.com/opencrvs/opencrvs-countryconfig/compare/v1.5.1...v1.5.2) From dbcb27f9e15579ef65b4b7346ca1af87cc19b169 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 20 Nov 2024 18:05:36 +0600 Subject: [PATCH 12/32] Revert "Merge pull request #324 from opencrvs/server-config" This reverts commit b7581efe9e195bc786fd73e54eec1b3eaf270397, reversing changes made to 1d3e670c3899b91e22df460b7eee713363258ac1. --- .../server-setup/inventory/backup.yml | 18 +++---------- .../server-setup/inventory/production.yml | 25 ++++++++----------- infrastructure/server-setup/inventory/qa.yml | 13 +++------- .../server-setup/inventory/staging.yml | 18 ++++++------- 4 files changed, 25 insertions(+), 49 deletions(-) diff --git a/infrastructure/server-setup/inventory/backup.yml b/infrastructure/server-setup/inventory/backup.yml index c3e91da7f..41ab8e839 100644 --- a/infrastructure/server-setup/inventory/backup.yml +++ b/infrastructure/server-setup/inventory/backup.yml @@ -21,23 +21,13 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: niko + - name: my-user ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGy93egakrVxXHb9LafRQ7T0Cl+p+gCTuymLyofTLK2ncwKhOZ/uV5SuzaKb4lJbBnpmxNdvAxsYXff5srvJfrV0ZZXFQdAAg0mmWuXxrhNfaE52S4s6WVKknTqDE5PhMxzVxzynBnaTdW9Cno7mO+rnS/VybjZIadpOuv5Bek1PztBmrUi4h0Qg1PxXNmFqzyc1dsil1T0nFeu5cH59G5fF1/oSUlC6CYBNoHdQ62IBoydBwMumk/trFoTlxPNK1wXgcUvsr8Sa5A4lN2Rrc6Y22CEGwomtyjHb2kDVbI+7B1Zq+S89yyyvkPFezEsCdK/Ehaj8HzfcsR/bassSn0/Xv3bL20eh7wv7cnut40kFizYifNGfpEqPvSzjfJbB4iG2WSKkW8F9t0/cvd0AdY/3jB0vXhvnRvCqHm1X6JVdGamF3GJeHUMk9JDg3rQdT47BZUtSJer4MGWWcNiALjeWPNLXK9cAvrI/6GbHbPyTzACfR6nhs03Z/eebuvpp0= - state: present - sudoer: true - - name: shoumik - ssh_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 - state: present - sudoer: true - - name: riku - ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true backups-host: hosts: - shoumikland-backup: # @todo set this to be the hostname of your backup server - ansible_host: '5.223.45.193' + backup: # @todo set this to be the hostname of your backup server + ansible_host: '66.66.66.66' diff --git a/infrastructure/server-setup/inventory/production.yml b/infrastructure/server-setup/inventory/production.yml index 7cb5c8f35..4176ff701 100644 --- a/infrastructure/server-setup/inventory/production.yml +++ b/infrastructure/server-setup/inventory/production.yml @@ -30,21 +30,16 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: riku + - name: my-user ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com - state: present - sudoer: true - - name: shoumik - ssh_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true docker-manager-first: hosts: - shoumikland-prod: # @todo set this to be the hostname of your target server - ansible_host: '5.223.47.240' # @todo set this to be the hostname of your target server + prod-01: # @todo set this to be the hostname of your target server + ansible_host: '22.22.22.22' # @todo set this to be the hostname of your target server data_label: data1 # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' # @todo set this to be the IP address of your jump server @@ -52,17 +47,17 @@ docker-manager-first: # @todo We recommend you add 2-4 workers for a scaled production deployment # This should depend on the size of your country and the number of end users. # If you are only using one production worker for very small countries or small pilot projects, replace with an empty block like so: docker-workers: {} -# docker-workers: -# hosts: -# prod-02: # @todo set this to be the hostname of your target server -# ansible_host: '33.33.33.33' +docker-workers: + hosts: + prod-02: # @todo set this to be the hostname of your target server + ansible_host: '33.33.33.33' # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' backups: hosts: - shoumikland-backup: # @todo set this to be the hostname of your backup server - ansible_host: '5.223.45.193' # set this to be the IP address of your backup server + backup: # @todo set this to be the hostname of your backup server + ansible_host: '66.66.66.66' # Written by provision pipeline. Assumes "backup" environment # exists in Github environments ansible_ssh_private_key_file: /tmp/backup_ssh_private_key diff --git a/infrastructure/server-setup/inventory/qa.yml b/infrastructure/server-setup/inventory/qa.yml index 1ccd47fe2..d1247ebc0 100644 --- a/infrastructure/server-setup/inventory/qa.yml +++ b/infrastructure/server-setup/inventory/qa.yml @@ -11,21 +11,16 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: riku + - name: my-user ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com - state: present - sudoer: true - - name: shoumik - ssh_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true docker-manager-first: hosts: - shoumikland-qa: # @todo set this to be the hostname of your target server - ansible_host: '5.223.51.253' # @todo set this to be the IP address of your server + qa: # @todo set this to be the hostname of your target server + ansible_host: '55.55.55.55' # @todo set this to be the IP address of your server # ansible_port: '23' # @todo set this to be the SSH port if it's not 22 # internal_ssh_port: '22' # @todo if you are port-forwarding and server SSH port is not the same as ansible_port, set it here data_label: data1 # for manager machines, this should always be "data1" diff --git a/infrastructure/server-setup/inventory/staging.yml b/infrastructure/server-setup/inventory/staging.yml index ecd002dff..50a6cb216 100644 --- a/infrastructure/server-setup/inventory/staging.yml +++ b/infrastructure/server-setup/inventory/staging.yml @@ -32,20 +32,16 @@ all: users: # @todo this is where you define which development team members have access to the server. # If you need to remove access from someone, do not remove them from this list, but instead set their state: absent - - name: riku + - name: my-user ssh_keys: - - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWIF63S4f3z9wQMvWibmvl7MPuJ6EVrkP0HuvgNhcs/4DZYMcR/GRBvV4ldOSYMlBevIXycgGzNDxKJgENUuwIWanjBu7uVAHyD6+cIRD1h63qq7Cjv/2HYTfBDKOrKzPOhA6zWvKO0ZGWsjRXk5LWMCbKOkvKJCxOpj/NVBxeE4FTK5YADYPV3OSsmBtqTHrVLm2sMmShU/2hMYYswWkobidjX65+nK/X+3C+yJbHwiydVvn+QCrFlFfCLPWKe8rUpOxyxofPqWVQh6CHhHfT8okaOc9sOE8Qeip9ljo84DftJh3Xm3ynOdWK1hH2BvRvxNadWqcE1qECbkg4tx2x riku.rouvila@gmail.com - state: present - sudoer: true - - name: shoumik - ssh_keys: - - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABg...Z/rhU= user@example.com state: present sudoer: true + docker-manager-first: hosts: - shoumikland-staging: # @todo set this to be the hostname of your target server - ansible_host: '5.223.51.99' # @todo set this to be the hostname of your target server + staging: # @todo set this to be the hostname of your target server + ansible_host: '11.11.11.11' # @todo set this to be the hostname of your target server data_label: data1 # If you are using a jump server to access this environment, enter other SSH args here. # ansible_ssh_common_args: '-J jump@55.55.55.55 -o StrictHostKeyChecking=no' # @todo set this to be the IP address of your jump server @@ -57,8 +53,8 @@ docker-workers: {} # @todo if you do not intend to set up automatic sync from the backup server, you can remove this section. backups: hosts: - shoumikland-backup: # @todo set this to be the hostname of your backup server - ansible_host: '5.223.45.193' # set this to be the IP address of your backup server + backup: # @todo set this to be the hostname of your backup server + ansible_host: '66.66.66.66' # set this to be the IP address of your backup server # Written by provision pipeline. Assumes "backup" environment # exists in Github environments ansible_ssh_private_key_file: /tmp/backup_ssh_private_key From eebfcfdeb0c557aa11027fb038d8760b21ce3f77 Mon Sep 17 00:00:00 2001 From: jamil314 Date: Thu, 21 Nov 2024 19:57:29 +0600 Subject: [PATCH 13/32] fix: label for time period options --- src/translations/client.csv | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/translations/client.csv b/src/translations/client.csv index 67b79213f..86a3744d8 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -1257,10 +1257,10 @@ form.section.information.death.bullet2,,As the legal Informant it is important t form.section.information.death.bullet3,,Once the declaration is processed you will receive an email to tell you when to visit the office to collect the certificate - Take your ID with you.,"Une fois la déclaration traitée, vous recevrez un courriel vous indiquant quand vous rendre au bureau pour retirer le certificat - Munissez-vous d'une pièce d'identité." form.section.information.death.bullet4,,Make sure you collect the certificate. A death certificate is critical to support with inheritance claims and to resolve the affairs of the deceased e.g. closing bank accounts and setting loans.,"Veillez à récupérer le certificat. Le certificat de décès est essentiel pour les demandes d'héritage et pour régler les affaires de la personne décédée, par exemple la fermeture des comptes bancaires et la mise en place des prêts." form.section.information.name,,Information,Informations -form.section.label.timePeriodLast30Days,Label for option of time period select: last 30 days,last 30 days,les 30 derniers jours -form.section.label.timePeriodLast7Days,Label for option of time period select: last 7 days,last 7 days,les 7 derniers jours -form.section.label.timePeriodLast90Days,Label for option of time period select: last 90 days,last 90 days,les 90 derniers jours -form.section.label.timePeriodLastYear,Label for option of time period select: last year,last year,l'année dernière +form.section.label.timePeriodLast30Days,Label for option of time period select: last 30 days,Last 30 days,les 30 derniers jours +form.section.label.timePeriodLast7Days,Label for option of time period select: last 7 days,Last 7 days,les 7 derniers jours +form.section.label.timePeriodLast90Days,Label for option of time period select: last 90 days,Last 90 days,les 90 derniers jours +form.section.label.timePeriodLastYear,Label for option of time period select: last year,Last year,l'année dernière form.section.marriageEvent.date,,Date of marriage,Date du mariage form.section.marriageEvent.name,,Marriage event details,Détails de l'événement de mariage form.section.marriageEvent.title,,Marriage details,Détails du mariage From a27cf0374a5dd6f7942e08b805e5dc02be7e7a49 Mon Sep 17 00:00:00 2001 From: jamil314 Date: Thu, 21 Nov 2024 19:57:49 +0600 Subject: [PATCH 14/32] fix: add missing translations --- src/translations/login.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/translations/login.csv b/src/translations/login.csv index adccc04d6..93ab9a672 100644 --- a/src/translations/login.csv +++ b/src/translations/login.csv @@ -50,6 +50,9 @@ password.minLength,Password validation,{min} characters minimum,{min} caractère password.mismatch,Password validation,Passwords do not match,Les mots de passe ne correspondent pas password.number,Password validation,At least one number,Au moins un chiffre password.validation.msg,Password validation message,Password must have:,"Le mot de passe doit avoir ," +reloadmodal.body,Body of reload modal,There’s a new version of {app_name} available. Please update to continue.,Une nouvelle version de {app_name} est disponible. Veuillez effectuer la mise à jour pour continuer. +reloadmodal.button.update,Label of update button,Update,Mise à jour +reloadmodal.title,Title when update is available,Update available,Mise à jour disponible resend.sms,Text for button that resend SMS or email verification code,"Resend {notificationMethod, select, sms {SMS} email {Email} other {}}","Renvoyer un {notificationMethod, select, sms {SMS} email {Email} other {}}" resetCredentials.emailAddressConfirmation.form.body.header,Form body header used in the body of email address confirmation step,Enter your email address,Entrez votre adresse email resetCredentials.forgottenItem.form.body.header,Body header for forgotten item form,Select an option,Qu'avez-vous oublié ? From 84027374ae406eeba2d60280e45205a02a21900e Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Tue, 26 Nov 2024 11:36:26 +0200 Subject: [PATCH 15/32] Bootstrap config for events service (#328) --- infrastructure/deployment/deploy.sh | 5 +++-- infrastructure/docker-compose.deploy.yml | 17 +++++++++++++++++ infrastructure/mongodb/on-deploy.sh | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index 1fba15161..f24531a21 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -306,8 +306,8 @@ docker_stack_deploy() { get_opencrvs_version() { PREVIOUS_VERSION=$(configured_ssh "docker service ls | grep opencrvs_base | cut -d ':' -f 2") - echo "Previous opencrvs version: $PREVIOUS_VERSION" - echo "Current opencrvs version: $VERSION" + echo "Previous opencrvs version: $PREVIOUS_VERSION" + echo "Current opencrvs version: $VERSION" } reset_metabase() { @@ -335,6 +335,7 @@ export PERFORMANCE_MONGODB_PASSWORD=`generate_password` export OPENHIM_MONGODB_PASSWORD=`generate_password` export WEBHOOKS_MONGODB_PASSWORD=`generate_password` export NOTIFICATION_MONGODB_PASSWORD=`generate_password` +export EVENTS_MONGODB_PASSWORD=`generate_password` # # Elasticsearch credentials diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 4252ba241..8003986a6 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -674,6 +674,23 @@ services: options: gelf-address: 'udp://127.0.0.1:12201' tag: 'user-mgnt' + events: + secrets: + - jwt-public-key.{{ts}} + environment: + - NODE_ENV=production + - MONGO_URL=mongodb://${STACK}__events:${METRICS_MONGODB_PASSWORD}@mongo1/${STACK}__events?replicaSet=rs0 + deploy: + labels: + - 'traefik.enable=false' + replicas: 1 + networks: + - overlay_net + logging: + driver: gelf + options: + gelf-address: 'udp://127.0.0.1:12201' + tag: 'events' notification: secrets: - jwt-public-key.{{ts}} diff --git a/infrastructure/mongodb/on-deploy.sh b/infrastructure/mongodb/on-deploy.sh index fc10bc854..49b4ec36a 100755 --- a/infrastructure/mongodb/on-deploy.sh +++ b/infrastructure/mongodb/on-deploy.sh @@ -252,4 +252,26 @@ else roles: [{ role: 'readWrite', db: 'notification' }] }) EOF +fi + +EVENTS_USER=$(echo $(checkIfUserExists "events")) +if [[ $EVENTS_USER != "FOUND" ]]; then + echo "events user not found --> creating" + mongo $(mongo_credentials) --host $HOST < updating credentials" + mongo $(mongo_credentials) --host $HOST < Date: Wed, 27 Nov 2024 17:43:53 +0600 Subject: [PATCH 16/32] Configured_ssh is used, as the docker prune should work on deply --- infrastructure/deployment/deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/deployment/deploy.sh b/infrastructure/deployment/deploy.sh index f24531a21..601ce1760 100755 --- a/infrastructure/deployment/deploy.sh +++ b/infrastructure/deployment/deploy.sh @@ -271,7 +271,7 @@ split_and_join() { cleanup_docker_images() { echo "Cleaning up the docker images" - /usr/bin/docker system prune -af | sudo tee -a /var/log/docker-prune.log > /dev/null + configured_ssh "/usr/bin/docker system prune -af | sudo tee -a /var/log/docker-prune.log > /dev/null" } docker_stack_deploy() { From 887e443b0ab061fbfd36091028da023afe85f6ed Mon Sep 17 00:00:00 2001 From: Jamil Date: Mon, 2 Dec 2024 14:58:01 +0600 Subject: [PATCH 17/32] feat: serve `tennis-club-membership-event` as example custom-event (#330) --- package.json | 1 + src/api/custom-event/handler.ts | 19 ++++ src/api/event-registration/handler.ts | 8 ++ src/form/tennis-club-membership.ts | 132 ++++++++++++++++++++++++++ src/index.ts | 11 +++ tsconfig.json | 4 +- yarn.lock | 5 + 7 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 src/api/custom-event/handler.ts create mode 100644 src/form/tennis-club-membership.ts diff --git a/package.json b/package.json index 19353732a..de35fc4b0 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "@hapi/boom": "^9.1.1", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", + "@opencrvs/toolkit": "^0.0.5", "@types/chalk": "^2.2.0", "@types/csv2json": "^1.4.0", "@types/fhir": "^0.0.30", diff --git a/src/api/custom-event/handler.ts b/src/api/custom-event/handler.ts new file mode 100644 index 000000000..ebc656b26 --- /dev/null +++ b/src/api/custom-event/handler.ts @@ -0,0 +1,19 @@ +/* + * 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 * as Hapi from '@hapi/hapi' +import { tennisClubMembershipEvent } from '@countryconfig/form/tennis-club-membership' + +export const customEventHandler = ( + request: Hapi.Request, + h: Hapi.ResponseToolkit +) => { + return h.response([tennisClubMembershipEvent]).code(200) +} diff --git a/src/api/event-registration/handler.ts b/src/api/event-registration/handler.ts index 4d0d7f0fd..63c5d86e9 100644 --- a/src/api/event-registration/handler.ts +++ b/src/api/event-registration/handler.ts @@ -16,6 +16,7 @@ import { confirmRegistration // rejectRegistration } from '@countryconfig/utils/gateway-api' +import { tennisClubMembershipEvent } from '@countryconfig/form/tennis-club-membership' export async function eventRegistrationHandler( request: Hapi.Request, @@ -67,3 +68,10 @@ export async function eventRegistrationHandler( return h.response().code(202) } + +export const tennisClubMembershipEventHandler = ( + request: Hapi.Request, + h: Hapi.ResponseToolkit +) => { + return h.response(tennisClubMembershipEvent).code(200) +} diff --git a/src/form/tennis-club-membership.ts b/src/form/tennis-club-membership.ts new file mode 100644 index 000000000..7cd31b438 --- /dev/null +++ b/src/form/tennis-club-membership.ts @@ -0,0 +1,132 @@ +/* + * 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 { defineConfig } from '@opencrvs/toolkit/events' + +export const tennisClubMembershipEvent = defineConfig({ + id: 'TENNIS_CLUB_MEMBERSHIP', + label: { + defaultMessage: 'Tennis club membership application', + description: 'This is what this event is referred as in the system', + id: 'event.tennis-club-membership.label' + }, + actions: [ + { + type: 'DECLARE', + label: { + defaultMessage: 'Send an application', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.declare.label' + }, + forms: [ + { + label: { + id: 'event.tennis-club-membership.action.declare.form.label', + defaultMessage: 'Tennis club membership application', + description: 'This is what this form is referred as in the system' + }, + active: true, + version: { + id: '1.0.0', + label: { + id: 'event.tennis-club-membership.action.declare.form.version.1', + defaultMessage: 'Version 1', + description: 'This is the first version of the form' + } + }, + pages: [ + { + id: 'applicant', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.who.title', + defaultMessage: 'Who is applying for the membership?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'applicant.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.firstname.label' + } + }, + { + id: 'applicant.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.surname.label' + } + }, + { + id: 'applicant.dob', + type: 'DATE', + required: true, + label: { + defaultMessage: "Applicant's date of birth", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.label' + } + } + ] + }, + { + id: 'recommender', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.recommender.title', + defaultMessage: 'Who is recommending the applicant?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'recommender.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label' + } + }, + { + id: 'recommender.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label' + } + }, + { + id: 'recommender.id', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's membership ID", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.id.label' + } + } + ] + } + ] + } + ] + } + ] +}) diff --git a/src/index.ts b/src/index.ts index c12d07052..4b7f57228 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,6 +62,7 @@ import { dashboardQueriesHandler } from './api/dashboards/handler' import { fontsHandler } from './api/fonts/handler' import { certificateConfigurationHandler } from './api/certificate-configuration/handler' import { recordNotificationHandler } from './api/record-notification/handler' +import { customEventHandler } from '@countryconfig/api/custom-event/handler' export interface ITokenPayload { sub: string @@ -545,6 +546,16 @@ export async function createServer() { } }) + server.route({ + method: 'GET', + path: '/events', + handler: customEventHandler, + options: { + tags: ['api', 'custom-event'], + description: 'Serves custom events' + } + }) + server.ext({ type: 'onRequest', method(request: Hapi.Request & { sentryScope?: any }, h) { diff --git a/tsconfig.json b/tsconfig.json index 05ab91cbb..12cb72786 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,10 +5,10 @@ "@countryconfig/*": ["./*"] }, "target": "es6", - "module": "commonjs", + "module": "Node16", "outDir": "build/dist", "sourceMap": true, - "moduleResolution": "node", + "moduleResolution": "node16", "rootDir": ".", "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022"], "forceConsistentCasingInFileNames": true, diff --git a/yarn.lock b/yarn.lock index 361bee9de..6d73f2987 100644 --- a/yarn.lock +++ b/yarn.lock @@ -790,6 +790,11 @@ dependencies: "@octokit/openapi-types" "^18.0.0" +"@opencrvs/toolkit@^0.0.5": + version "0.0.5" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.5.tgz#dbd3395b561c1eb3527b8cfc28b6e1dd301671f3" + integrity sha512-Ex45aFUJ1iQwpYGMHhxVbhpuQFqVlmdSkNXz1phkM7KAzNtngL2KGIJCc6TFv4GKOHU/lLEfmGyrhIDCKlA7fQ== + "@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" From 75de9a436cd40a6d12fbd6ca8d45bc3742fcd88a Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Mon, 2 Dec 2024 11:08:47 +0200 Subject: [PATCH 18/32] fix(events): invalid password reference in events service mongodb connection string --- infrastructure/docker-compose.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 54632d423..d8d5d799e 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -679,7 +679,7 @@ services: - jwt-public-key.{{ts}} environment: - NODE_ENV=production - - MONGO_URL=mongodb://${STACK}__events:${METRICS_MONGODB_PASSWORD}@mongo1/${STACK}__events?replicaSet=rs0 + - MONGO_URL=mongodb://events:${METRICS_MONGODB_PASSWORD}@mongo1/events?replicaSet=rs0 deploy: labels: - 'traefik.enable=false' From 45ce7e6b39b37359075b02ade0641131b083cb2c Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Mon, 2 Dec 2024 11:09:24 +0200 Subject: [PATCH 19/32] fix(events): invalid password reference in events service mongodb connection string --- infrastructure/docker-compose.deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 8003986a6..7d7c133bc 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -679,7 +679,7 @@ services: - jwt-public-key.{{ts}} environment: - NODE_ENV=production - - MONGO_URL=mongodb://${STACK}__events:${METRICS_MONGODB_PASSWORD}@mongo1/${STACK}__events?replicaSet=rs0 + - MONGO_URL=mongodb://events:${EVENTS_MONGODB_PASSWORD}@mongo1/events?replicaSet=rs0 deploy: labels: - 'traefik.enable=false' From 6bfc039e3d901ae01f32cf5e45d83b682a2324eb Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" <43688097+alsmk@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:26:55 +0600 Subject: [PATCH 20/32] added new approver : alsmk (#1179) --- .github/workflows/deploy-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 30f89c55d..45b819afb 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -28,7 +28,7 @@ jobs: - uses: trstringer/manual-approval@v1 with: secret: ${{ github.TOKEN }} - approvers: euanmillar,rikukissa + approvers: euanmillar,rikukissa,alsmk minimum-approvals: 1 issue-title: 'Deploy (${{ github.event.inputs.environment }}): core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }}' issue-body: 'Please approve or deny the deployment of core: ${{ github.event.inputs.core-image-tag }} country config: ${{ github.event.inputs.countryconfig-image-tag }} to ${{ github.event.inputs.environment }}' From c8a8d12607d6d96ceee0bae7896c66fc9318ac21 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Wed, 4 Dec 2024 17:25:35 +0600 Subject: [PATCH 21/32] added new ssh user : shoumik --- infrastructure/server-setup/inventory/backup.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/infrastructure/server-setup/inventory/backup.yml b/infrastructure/server-setup/inventory/backup.yml index e66679042..cda887d33 100644 --- a/infrastructure/server-setup/inventory/backup.yml +++ b/infrastructure/server-setup/inventory/backup.yml @@ -33,6 +33,11 @@ all: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGy93egakrVxXHb9LafRQ7T0Cl+p+gCTuymLyofTLK2ncwKhOZ/uV5SuzaKb4lJbBnpmxNdvAxsYXff5srvJfrV0ZZXFQdAAg0mmWuXxrhNfaE52S4s6WVKknTqDE5PhMxzVxzynBnaTdW9Cno7mO+rnS/VybjZIadpOuv5Bek1PztBmrUi4h0Qg1PxXNmFqzyc1dsil1T0nFeu5cH59G5fF1/oSUlC6CYBNoHdQ62IBoydBwMumk/trFoTlxPNK1wXgcUvsr8Sa5A4lN2Rrc6Y22CEGwomtyjHb2kDVbI+7B1Zq+S89yyyvkPFezEsCdK/Ehaj8HzfcsR/bassSn0/Xv3bL20eh7wv7cnut40kFizYifNGfpEqPvSzjfJbB4iG2WSKkW8F9t0/cvd0AdY/3jB0vXhvnRvCqHm1X6JVdGamF3GJeHUMk9JDg3rQdT47BZUtSJer4MGWWcNiALjeWPNLXK9cAvrI/6GbHbPyTzACfR6nhs03Z/eebuvpp0= state: present sudoer: true + - name: shoumik + ssh_keys: + - ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRSRTqm3vOfjyTutISEtbVp7ZddoWa9NZDZLeWZGzLy dsi@dsi-Inspiron-15-3511 + state: present + sudoer: true backups-host: hosts: From df5646fd55a4e064c04fca2953f57b2a09807f54 Mon Sep 17 00:00:00 2001 From: Tameem Bin Haider Date: Thu, 5 Dec 2024 17:53:50 +0600 Subject: [PATCH 22/32] fix: use form data to check if details exist (#334) * fix: use form data to check if details exist * docs: update CHANGELOG --- CHANGELOG.md | 11 ++++++++++- src/form/addresses/index.ts | 19 ++++++++----------- .../common/default-validation-conditionals.ts | 10 +--------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc0ffc90..b8243fcc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,15 @@ INSERT CSV ROWS IN ENGLISH ONLY - TBC -## 1.6.0 Release candidate +## 1.6.1 (TBD) + +### Bug fixes + +- We make sure that the automatic cleanup job only runs before deployment (instead of cron schedule cleanup). +- Previously it was possible MongoDB replica set and users were left randomly uninitialised after a deployment. MongoDB initialisation container now retries on failure. +- On some machines 'file' utility was not preinstalled causing provision to fail. We now install the utility if it doesn't exist. + +## 1.6.0 ### Breaking changes @@ -93,6 +101,7 @@ INSERT CSV ROWS IN ENGLISH ONLY 5. 'PHONE_NUMBER', 6. 'EMAIL' - Updated `allowedFileFormats` in signature fields to use MIME types (`image/png`, `image/jpg`, `image/jpeg`, `image/svg`) instead of simple file extensions. If you are already using the `allowedFileFormats` field in your implementation, please ensure to update the format accordingly. +- The details exists conditionals for the various sections i.e. father, mother, spouse has to use the `values.detailsExist` property instead of accessing it from `draftData.[sectionName].detailsExists`. This is due to the fact that the draftData is not populated until any changes have been made to any of the fields in the current section. ### New features diff --git a/src/form/addresses/index.ts b/src/form/addresses/index.ts index 6576f0015..920f09390 100644 --- a/src/form/addresses/index.ts +++ b/src/form/addresses/index.ts @@ -10,9 +10,6 @@ */ import { - FATHER_DETAILS_DONT_EXIST, - MOTHER_DETAILS_DONT_EXIST, - SPOUSE_DETAILS_DONT_EXIST, detailsDontExist, expressionToConditional, hideIfInformantBrideOrGroom, @@ -99,11 +96,11 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [ { config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION, label: formMessageDescriptors.primaryAddress, - conditionalCase: MOTHER_DETAILS_DONT_EXIST + conditionalCase: detailsDontExist }, { config: AddressCases.PRIMARY_ADDRESS, - conditionalCase: MOTHER_DETAILS_DONT_EXIST + conditionalCase: detailsDontExist } /*, { config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION, @@ -125,9 +122,9 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [ config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION, label: formMessageDescriptors.primaryAddress, conditionalCase: [ - expressionToConditional(FATHER_DETAILS_DONT_EXIST), + expressionToConditional(detailsDontExist), expressionToConditional( - `${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}`, + `${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}`, 'hideInPreview' ) ] @@ -149,7 +146,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [ }, { config: AddressCases.PRIMARY_ADDRESS, - conditionalCase: `((${FATHER_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))` + conditionalCase: `((${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}) && !(${mothersDetailsDontExistOnOtherPage}) || ((${detailsDontExist}) && (${mothersDetailsDontExistOnOtherPage})))` } /*, { config: AddressSubsections.SECONDARY_ADDRESS_SUBSECTION, @@ -275,9 +272,9 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [ config: AddressSubsections.PRIMARY_ADDRESS_SUBSECTION, label: formMessageDescriptors.primaryAddress, conditionalCase: [ - expressionToConditional(SPOUSE_DETAILS_DONT_EXIST), + expressionToConditional(detailsDontExist), expressionToConditional( - `${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}`, + `${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress}`, 'hideInPreview' ) ] @@ -297,7 +294,7 @@ export const defaultAddressConfiguration: IAddressConfiguration[] = [ }, { config: AddressCases.PRIMARY_ADDRESS, - conditionalCase: `((${SPOUSE_DETAILS_DONT_EXIST} || ${primaryAddressSameAsOtherPrimaryAddress}) || (${detailsDontExist}))` + conditionalCase: `(${detailsDontExist} || ${primaryAddressSameAsOtherPrimaryAddress})` } ] }, diff --git a/src/form/common/default-validation-conditionals.ts b/src/form/common/default-validation-conditionals.ts index d0038478b..d67d06881 100644 --- a/src/form/common/default-validation-conditionals.ts +++ b/src/form/common/default-validation-conditionals.ts @@ -9,7 +9,6 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ import { Conditional } from '../types/types' -import { IntegratingSystemType } from '../types/types' import { Validator } from '../types/validators' /** @@ -442,18 +441,11 @@ export const spouseFamilyNameConditionals = [ } ] -export const FATHER_DETAILS_DONT_EXIST = - '(draftData?.father && !draftData?.father.detailsExist) || !values.detailsExist' -export const MOTHER_DETAILS_DONT_EXIST = - '(draftData?.mother && !draftData?.mother.detailsExist) || !values.detailsExist' -export const SPOUSE_DETAILS_DONT_EXIST = - '(draftData?.spouse && !draftData?.spouse.detailsExist) || !values.detailsExist' - // if mothers details do not exist on other page export const mothersDetailsDontExistOnOtherPage = 'draftData && draftData.mother && !draftData.mother.detailsExist' -// if fathers details do not exist +// if details don't exist for the current section export const detailsDontExist = '!values.detailsExist' // primary address same as other primary From a6819e06d1cad2a79dc11e43255547e1631f26ce Mon Sep 17 00:00:00 2001 From: Pyry Rouvila Date: Thu, 5 Dec 2024 16:10:33 +0200 Subject: [PATCH 23/32] fix(events): add mongodb password to docker-compose --- infrastructure/docker-compose.deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index 7d7c133bc..f561e8909 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -243,6 +243,7 @@ services: - OPENHIM_MONGODB_PASSWORD=${OPENHIM_MONGODB_PASSWORD} - WEBHOOKS_MONGODB_PASSWORD=${WEBHOOKS_MONGODB_PASSWORD} - NOTIFICATION_MONGODB_PASSWORD=${NOTIFICATION_MONGODB_PASSWORD} + - EVENTS_MONGODB_PASSWORD=${EVENTS_MONGODB_PASSWORD} networks: - overlay_net logging: From 63f1aa06923bc41a4cca1e5cb704d795c8c79ce8 Mon Sep 17 00:00:00 2001 From: Pyry Rouvila Date: Thu, 5 Dec 2024 16:11:12 +0200 Subject: [PATCH 24/32] fix(events): add mongodb password to docker-compose --- infrastructure/docker-compose.deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/infrastructure/docker-compose.deploy.yml b/infrastructure/docker-compose.deploy.yml index dd756b461..7613e01a8 100644 --- a/infrastructure/docker-compose.deploy.yml +++ b/infrastructure/docker-compose.deploy.yml @@ -243,6 +243,7 @@ services: - OPENHIM_MONGODB_PASSWORD=${OPENHIM_MONGODB_PASSWORD} - WEBHOOKS_MONGODB_PASSWORD=${WEBHOOKS_MONGODB_PASSWORD} - NOTIFICATION_MONGODB_PASSWORD=${NOTIFICATION_MONGODB_PASSWORD} + - EVENTS_MONGODB_PASSWORD=${EVENTS_MONGODB_PASSWORD} networks: - overlay_net logging: From 4c7fde582b8e4676871a8476b375ff40a7875842 Mon Sep 17 00:00:00 2001 From: Jamil Date: Wed, 11 Dec 2024 12:32:15 +0600 Subject: [PATCH 25/32] chore: add translations for v2 pages (#336) * chore: add translations for v2 review page * chore: add translations for event config * chore: remove duplicate translation --- src/translations/client.csv | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/translations/client.csv b/src/translations/client.csv index f634e7454..bc9f86e13 100644 --- a/src/translations/client.csv +++ b/src/translations/client.csv @@ -168,6 +168,10 @@ certificate.receipt.service.targetDay,,{event} registration after 45 days of eve certificate.receipt.service.targetDay.amount,,৳ 25.00,৳ 25.00 certificate.receipt.subheader,Subheader for receipt on payment on certificate,{event} Registration after {DOBDiff} of {DOE},{event} Déclaration après {DOBDiff} de {DOE} changeEmail.validation.msg,Phone number validation message,Must be a valid email address,Doit être une adresse e-mail valide +changeModal.cancel,The label for cancel button of change modal,Cancel,Annuler +changeModal.continue,The label for continue button of change modal,Continue,Continuer +changeModal.description,The description for change modal,A record will be created of any changes you make,Un enregistrement sera créé pour chaque modification que vous apporterez. +changeModal.title,The title for change modal,Edit declaration?,Modifier la déclaration? changePhone.validation.msg,Phone number validation message,Must be a valid 10 digit number that starts with 0,Doit être un numéro valide à {num} chiffres qui commence par {start}. config.advanced.search,This is used for the advanced search,Advanced Search,Recherche avancée config.advanced.search.instruction,This is used for the advanced search,Select the options to build an advanced search. A minimum of two search parameters is required.,Sélectionnez les options pour construire une recherche avancée. Un minimum de deux paramètres de recherche est requis. @@ -786,6 +790,21 @@ error.title,Error title,Oops!,Oups ! error.title.unauthorized,Error title unauthorized,Unauthorized!,Non autorisé ! error.userListError,Error message when user list loads fails,Failed to load users,Impossible de charger les utilisateurs error.weAreTryingToFixThisError,Error description,This page could not be found,"Ce n'est pas vous, c'est nous. C'est notre faute." +event.tennis-club-membership.action.declare.form.label,This is what this form is referred as in the system,Tennis club membership application,Demande d'adhésion au club de tennis +event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label,This is the label for the field,Recommender's first name,Prénom du recommandeur +event.tennis-club-membership.action.declare.form.section.recommender.field.id.label,This is the label for the field,Recommender's membership ID,ID d'adhésion du recommandeur +event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label,This is the label for the field,Recommender's surname,Nom de famille du recommandeur +event.tennis-club-membership.action.declare.form.section.recommender.title,This is the title of the section,Who is recommending the applicant?,Qui recommande le demandeur? +event.tennis-club-membership.action.declare.form.section.who.field.dob.label,This is the label for the field,Applicant's date of birth,Date de naissance du demandeur +event.tennis-club-membership.action.declare.form.section.who.field.firstname.label,This is the label for the field,Applicant's first name,Prénom du demandeur +event.tennis-club-membership.action.declare.form.section.who.field.surname.label,This is the label for the field,Applicant's surname,Nom de famille du demandeur +event.tennis-club-membership.action.declare.form.section.who.title,This is the title of the section,Who is applying for the membership?,Qui postule pour l'adhésion? +event.tennis-club-membership.action.declare.form.version.1,This is the first version of the form,Version 1,Version 1 +event.tennis-club-membership.action.declare.label,This is shown as the action name anywhere the user can trigger the action from,Send an application,Envoyer une demande +event.tennis-club-membership.label,This is what this event is referred as in the system,Tennis club membership application,Demande d'adhésion au club de tennis +exitModal.cancel,The label for cancel button in exit modal,Cancel,Annuler +exitModal.exitWithoutSaving,The title for exit without saving modal,Exit without saving changes?,Quitter sans enregistrer les modifications? +exitModal.exitWithoutSavingDescription,The description for exit without saving modal,You have unsaved changes on your declaration form. Are you sure you want to exit without saving?,Vous avez des modifications non enregistrées sur votre formulaire de déclaration. Êtes-vous sûr de vouloir quitter sans enregistrer? fieldAgentHome.allUpdatesText,,Great job! You have updated all declarations,Bon travail ! Vous avez mis à jour toutes les déclarations fieldAgentHome.inProgressCount,,In progress ({total}),En cours ({total}) fieldAgentHome.queryError,The text when error ocurred loading rejected declarations,An error occurred while loading declarations,Une erreur s'est produite lors du chargement des déclarations @@ -1761,6 +1780,16 @@ register.selectVitalEvent.registerNewEventHeading,The section heading on the pag register.selectVitalEvent.registerNewEventTitle,The title that appears on the select vital event page,New declaration,Nouvelle déclaration register.selectinformant.legalGuardian,,Legal guardian,Tuteur légal register.workQueue.declarations.banner,,Declarations to register in your area,Déclarations à enregistrer dans votre région +registerModal.cancel,The label for cancel button of register modal,Cancel,Annuler +registerModal.description,The description for register modal,The declarant will be notified of this correction and a record of this decision will be recorded,Le déclarant sera informé de cette correction et un enregistrement de cette décision sera créé. +registerModal.register,The label for register button of register modal,Register,Enregistrer +registerModal.title,The title for register modal,Register the member?,Enregistrer le membre? +rejectModal.archive,The label for archive button of reject modal,Archive,Archiver +rejectModal.cancel,The label for cancel button of reject modal,Cancel,Annuler +rejectModal.description,The description for reject modal,Please describe the updates required to this record for follow up action.,Veuillez décrire les mises à jour nécessaires à ce dossier pour un suivi. +rejectModal.markAsDuplicate,The label for mark as duplicate checkbox of reject modal,Mark as a duplicate,Marquer comme doublon +rejectModal.sendForUpdate,The label for send For Update button of reject modal,Send For Update,Envoyer pour mise à jour +rejectModal.title,The title for reject modal,Reason for rejection?,Raison du rejet? reloadmodal.body,Body of reload modal,There’s a new version of {app_name} available. Please update to continue.,Une nouvelle version de {app_name} est disponible. Veuillez effectuer la mise à jour pour continuer. reloadmodal.button.update,Label of update button,Update,Mise à jour reloadmodal.title,Title when update is available,Update available,Mise à jour disponible @@ -1817,6 +1846,10 @@ review.signature.delete,Label for button that deletes signature,Delete,Supprimer review.signature.description,Label awknowledging the correctness of the declaration,"I, the undersigned, hereby declare that the particulars in this form are true and correct to the best of my knowledge.","Je soussigné(e) déclare par la présente que les informations contenues dans ce formulaire sont, à ma connaissance, vraies et correctes." review.signature.input.description,Description awknowledging the correctness of the declaration,"By signing this document with an electronic signature, I agree that such signature will be valid as handwritten signatures to the extent allowed by the laws of Farajaland.","En signant ce document avec une signature électronique, j'accepte que cette signature soit valable comme les signatures manuscrites dans la mesure où les lois du Farajaland le permettent." review.signature.open,Label for button that opens the signature input,Sign,Signer +reviewAction.description,The description for review action,"By clicking register, you confirm that the information entered is correct and the member can be registered.","En cliquant sur enregistrer, vous confirmez que les informations saisies sont correctes et que le membre peut être enregistré." +reviewAction.register,The label for register button of review action,Register,Enregistrer +reviewAction.reject,The label for reject button of review action,Reject,Rejeter +reviewAction.title,The title for review action,Register member,Enregistrer un membre search.bookmark.error.notification,Error Notification messages for bookmark advanced search result,"Sorry, something went wrong. Please try again","Désolé, quelque chose s'est mal passé. Veuillez réessayer" search.bookmark.loading.notification,Loading Notification messages for bookmark advanced search result,Bookmarking your advanced search results...,Mettre en signet les résultats de votre recherche avancée... search.bookmark.remove.loading.notification,Loading Notification messages for remove advanced search bookmark,Removing your advanced search bookmark...,Suppression de votre signet de recherche avancée... From 180ea298cbc34138316b07a63711eaf03ff5c310 Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Tue, 17 Dec 2024 10:26:18 +0200 Subject: [PATCH 26/32] Events v2: add config for summary and workqueues (#344) * feat: add config for summary and workqueues * configure statusm created at, modified at to be default columns * feat: move review title to config * feat: add form for register * add conditional rules for action visibility * add more actions and conditionality * do not show register action after a record already has a register action * Events v2: form field validation example (#343) * add conditional rules for action visibility * add more actions and conditionality * do not show register action after a record already has a register action * add example form field validation * comment out file field for now * remove conditionals * update toolkit version --------- Co-authored-by: Markus Co-authored-by: jamil314 --- package.json | 2 +- src/form/tennis-club-membership.ts | 384 +++++++++++++++++++++-------- 2 files changed, 283 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index de35fc4b0..fd4ac8e66 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.5", + "@opencrvs/toolkit": "0.0.6-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 7cd31b438..efb0ec55d 100644 --- a/src/form/tennis-club-membership.ts +++ b/src/form/tennis-club-membership.ts @@ -9,7 +9,142 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import { defineConfig } from '@opencrvs/toolkit/events' +import { defineConfig, defineForm } from '@opencrvs/toolkit/events' +import { + defineConditional, + or, + eventHasAction, + userHasScope, + and, + not, + field +} from '@opencrvs/toolkit/conditionals' + +const TENNIS_CLUB_FORM = defineForm({ + label: { + id: 'event.tennis-club-membership.action.declare.form.label', + defaultMessage: 'Tennis club membership application', + description: 'This is what this form is referred as in the system' + }, + review: { + title: { + id: 'event.tennis-club-membership.action.declare.form.review.title', + defaultMessage: 'Member declaration for {firstname} {surname}', + description: 'Title of the form to show in review page' + } + }, + active: true, + version: { + id: '1.0.0', + label: { + id: 'event.tennis-club-membership.action.declare.form.version.1', + defaultMessage: 'Version 1', + description: 'This is the first version of the form' + } + }, + pages: [ + { + id: 'applicant', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.who.title', + defaultMessage: 'Who is applying for the membership?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'applicant.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.firstname.label' + } + }, + { + id: 'applicant.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.surname.label' + } + }, + { + id: 'applicant.dob', + type: 'DATE', + required: true, + validation: [ + { + message: { + defaultMessage: 'Please enter a valid date', + description: 'This is the error message for invalid date', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.error' + }, + validator: field('applicant.dob').isBeforeNow() + } + ], + label: { + defaultMessage: "Applicant's date of birth", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.label' + } + } + // { + // id: 'applicant.image', + // type: 'FILE', + // required: false, + // label: { + // defaultMessage: "Applicant's profile picture", + // description: 'This is the label for the field', + // id: 'event.tennis-club-membership.action.declare.form.section.who.field.image.label' + // } + // } + ] + }, + { + id: 'recommender', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.recommender.title', + defaultMessage: 'Who is recommending the applicant?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'recommender.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label' + } + }, + { + id: 'recommender.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label' + } + }, + { + id: 'recommender.id', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's membership ID", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.id.label' + } + } + ] + } + ] +}) export const tennisClubMembershipEvent = defineConfig({ id: 'TENNIS_CLUB_MEMBERSHIP', @@ -18,115 +153,160 @@ export const tennisClubMembershipEvent = defineConfig({ description: 'This is what this event is referred as in the system', id: 'event.tennis-club-membership.label' }, + summary: { + title: { + defaultMessage: '{applicant.firstname} {applicant.surname}', + description: 'This is the title of the summary', + id: 'event.tennis-club-membership.summary.title' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'applicant.surname' + }, + { + id: 'recommender.firstname' + }, + { + id: 'recommender.surname' + }, + { + id: 'recommender.id' + } + ] + }, + workqueues: [ + { + id: 'all', + title: { + defaultMessage: 'All events', + description: 'Label for in progress workqueue', + id: 'event.tennis-club-membership.workqueue.all.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'applicant.surname' + } + ], + filters: [] + }, + { + id: 'ready-for-review', + title: { + defaultMessage: 'Ready for review', + description: 'Label for in review workqueue', + id: 'event.tennis-club-membership.workqueue.in-review.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'event.type' + }, + { + id: 'event.createdAt' + }, + { + id: 'event.modifiedAt' + } + ], + filters: [ + { + status: ['DECLARED'] + } + ] + }, + { + id: 'registered', + title: { + defaultMessage: 'Ready to print', + description: 'Label for registered workqueue', + id: 'event.tennis-club-membership.workqueue.registered.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'event.type' + }, + { + id: 'event.createdAt' + }, + { + id: 'event.modifiedAt' + } + ], + filters: [ + { + status: ['REGISTERED'] + } + ] + } + ], actions: [ { type: 'DECLARE', label: { - defaultMessage: 'Send an application', + defaultMessage: 'Declare', description: 'This is shown as the action name anywhere the user can trigger the action from', id: 'event.tennis-club-membership.action.declare.label' }, - forms: [ - { - label: { - id: 'event.tennis-club-membership.action.declare.form.label', - defaultMessage: 'Tennis club membership application', - description: 'This is what this form is referred as in the system' - }, - active: true, - version: { - id: '1.0.0', - label: { - id: 'event.tennis-club-membership.action.declare.form.version.1', - defaultMessage: 'Version 1', - description: 'This is the first version of the form' - } - }, - pages: [ - { - id: 'applicant', - title: { - id: 'event.tennis-club-membership.action.declare.form.section.who.title', - defaultMessage: 'Who is applying for the membership?', - description: 'This is the title of the section' - }, - fields: [ - { - id: 'applicant.firstname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Applicant's first name", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.firstname.label' - } - }, - { - id: 'applicant.surname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Applicant's surname", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.surname.label' - } - }, - { - id: 'applicant.dob', - type: 'DATE', - required: true, - label: { - defaultMessage: "Applicant's date of birth", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.label' - } - } - ] - }, - { - id: 'recommender', - title: { - id: 'event.tennis-club-membership.action.declare.form.section.recommender.title', - defaultMessage: 'Who is recommending the applicant?', - description: 'This is the title of the section' - }, - fields: [ - { - id: 'recommender.firstname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's first name", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label' - } - }, - { - id: 'recommender.surname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's surname", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label' - } - }, - { - id: 'recommender.id', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's membership ID", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.id.label' - } - } - ] - } - ] - } - ] + forms: [TENNIS_CLUB_FORM], + allowedWhen: defineConditional(not(eventHasAction('DECLARE'))) + }, + { + type: 'VALIDATE', + label: { + defaultMessage: 'Validate', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.validate.label' + }, + allowedWhen: defineConditional(eventHasAction('DECLARE')), + forms: [TENNIS_CLUB_FORM] + }, + { + type: 'REGISTER', + label: { + defaultMessage: 'Register', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.register.label' + }, + allowedWhen: defineConditional( + and( + or( + eventHasAction('VALIDATE'), + and(eventHasAction('DECLARE'), userHasScope('register')) + ), + not(eventHasAction('REGISTER')) + ) + ), + forms: [TENNIS_CLUB_FORM] + }, + { + type: 'CUSTOM', + label: { + defaultMessage: 'My custom action', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.sdf.label' + }, + allowedWhen: defineConditional( + or( + eventHasAction('VALIDATE'), + and(eventHasAction('DECLARE'), userHasScope('register')) + ) + ), + forms: [] } ] }) From 1efe3182e1573e8b9728cf6b76de8e31c4b4cf0e Mon Sep 17 00:00:00 2001 From: Riku Rouvila Date: Wed, 18 Dec 2024 16:18:41 +0200 Subject: [PATCH 27/32] Events v2: add config for summary and workqueues (#1188) * feat: add config for summary and workqueues * configure statusm created at, modified at to be default columns * feat: move review title to config * feat: add form for register * add conditional rules for action visibility * add more actions and conditionality * do not show register action after a record already has a register action * Events v2: form field validation example (#343) * add conditional rules for action visibility * add more actions and conditionality * do not show register action after a record already has a register action * add example form field validation * comment out file field for now * remove conditionals * update toolkit version * add e2e back * remove added schema file * upgrade faker.js --------- Co-authored-by: Markus Co-authored-by: jamil314 --- package.json | 4 +- src/data-generator/address.ts | 2 +- src/data-generator/users.ts | 2 +- src/form/tennis-club-membership.ts | 384 +++++++++++++++++++++-------- yarn.lock | 43 +++- 5 files changed, 321 insertions(+), 114 deletions(-) diff --git a/package.json b/package.json index 12b72df00..e9ed98521 100644 --- a/package.json +++ b/package.json @@ -71,12 +71,12 @@ "vitest": "^2.1.2" }, "dependencies": { - "@faker-js/faker": "^6.0.0-alpha.5", + "@faker-js/faker": "^7.6.0", "@hapi/boom": "^9.1.1", "@hapi/h2o2": "^9.1.0", "@hapi/hapi": "^20.0.1", "@hapi/inert": "^6.0.3", - "@opencrvs/toolkit": "^0.0.5", + "@opencrvs/toolkit": "0.0.6-events", "@types/chalk": "^2.2.0", "@types/code": "^4.0.3", "@types/csv2json": "^1.4.0", diff --git a/src/data-generator/address.ts b/src/data-generator/address.ts index 0ee4e915d..c5225e910 100644 --- a/src/data-generator/address.ts +++ b/src/data-generator/address.ts @@ -1,4 +1,4 @@ -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { Location } from './location' export function createAddressInput(location: Location, type: string) { diff --git a/src/data-generator/users.ts b/src/data-generator/users.ts index 393fa8693..59c7b093f 100644 --- a/src/data-generator/users.ts +++ b/src/data-generator/users.ts @@ -1,4 +1,4 @@ -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { log } from './util' import { Facility, getFacilities, Location } from './location' import fetch from 'node-fetch' diff --git a/src/form/tennis-club-membership.ts b/src/form/tennis-club-membership.ts index 7cd31b438..efb0ec55d 100644 --- a/src/form/tennis-club-membership.ts +++ b/src/form/tennis-club-membership.ts @@ -9,7 +9,142 @@ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. */ -import { defineConfig } from '@opencrvs/toolkit/events' +import { defineConfig, defineForm } from '@opencrvs/toolkit/events' +import { + defineConditional, + or, + eventHasAction, + userHasScope, + and, + not, + field +} from '@opencrvs/toolkit/conditionals' + +const TENNIS_CLUB_FORM = defineForm({ + label: { + id: 'event.tennis-club-membership.action.declare.form.label', + defaultMessage: 'Tennis club membership application', + description: 'This is what this form is referred as in the system' + }, + review: { + title: { + id: 'event.tennis-club-membership.action.declare.form.review.title', + defaultMessage: 'Member declaration for {firstname} {surname}', + description: 'Title of the form to show in review page' + } + }, + active: true, + version: { + id: '1.0.0', + label: { + id: 'event.tennis-club-membership.action.declare.form.version.1', + defaultMessage: 'Version 1', + description: 'This is the first version of the form' + } + }, + pages: [ + { + id: 'applicant', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.who.title', + defaultMessage: 'Who is applying for the membership?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'applicant.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.firstname.label' + } + }, + { + id: 'applicant.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Applicant's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.surname.label' + } + }, + { + id: 'applicant.dob', + type: 'DATE', + required: true, + validation: [ + { + message: { + defaultMessage: 'Please enter a valid date', + description: 'This is the error message for invalid date', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.error' + }, + validator: field('applicant.dob').isBeforeNow() + } + ], + label: { + defaultMessage: "Applicant's date of birth", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.label' + } + } + // { + // id: 'applicant.image', + // type: 'FILE', + // required: false, + // label: { + // defaultMessage: "Applicant's profile picture", + // description: 'This is the label for the field', + // id: 'event.tennis-club-membership.action.declare.form.section.who.field.image.label' + // } + // } + ] + }, + { + id: 'recommender', + title: { + id: 'event.tennis-club-membership.action.declare.form.section.recommender.title', + defaultMessage: 'Who is recommending the applicant?', + description: 'This is the title of the section' + }, + fields: [ + { + id: 'recommender.firstname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's first name", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label' + } + }, + { + id: 'recommender.surname', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's surname", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label' + } + }, + { + id: 'recommender.id', + type: 'TEXT', + required: true, + label: { + defaultMessage: "Recommender's membership ID", + description: 'This is the label for the field', + id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.id.label' + } + } + ] + } + ] +}) export const tennisClubMembershipEvent = defineConfig({ id: 'TENNIS_CLUB_MEMBERSHIP', @@ -18,115 +153,160 @@ export const tennisClubMembershipEvent = defineConfig({ description: 'This is what this event is referred as in the system', id: 'event.tennis-club-membership.label' }, + summary: { + title: { + defaultMessage: '{applicant.firstname} {applicant.surname}', + description: 'This is the title of the summary', + id: 'event.tennis-club-membership.summary.title' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'applicant.surname' + }, + { + id: 'recommender.firstname' + }, + { + id: 'recommender.surname' + }, + { + id: 'recommender.id' + } + ] + }, + workqueues: [ + { + id: 'all', + title: { + defaultMessage: 'All events', + description: 'Label for in progress workqueue', + id: 'event.tennis-club-membership.workqueue.all.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'applicant.surname' + } + ], + filters: [] + }, + { + id: 'ready-for-review', + title: { + defaultMessage: 'Ready for review', + description: 'Label for in review workqueue', + id: 'event.tennis-club-membership.workqueue.in-review.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'event.type' + }, + { + id: 'event.createdAt' + }, + { + id: 'event.modifiedAt' + } + ], + filters: [ + { + status: ['DECLARED'] + } + ] + }, + { + id: 'registered', + title: { + defaultMessage: 'Ready to print', + description: 'Label for registered workqueue', + id: 'event.tennis-club-membership.workqueue.registered.label' + }, + fields: [ + { + id: 'applicant.firstname' + }, + { + id: 'event.type' + }, + { + id: 'event.createdAt' + }, + { + id: 'event.modifiedAt' + } + ], + filters: [ + { + status: ['REGISTERED'] + } + ] + } + ], actions: [ { type: 'DECLARE', label: { - defaultMessage: 'Send an application', + defaultMessage: 'Declare', description: 'This is shown as the action name anywhere the user can trigger the action from', id: 'event.tennis-club-membership.action.declare.label' }, - forms: [ - { - label: { - id: 'event.tennis-club-membership.action.declare.form.label', - defaultMessage: 'Tennis club membership application', - description: 'This is what this form is referred as in the system' - }, - active: true, - version: { - id: '1.0.0', - label: { - id: 'event.tennis-club-membership.action.declare.form.version.1', - defaultMessage: 'Version 1', - description: 'This is the first version of the form' - } - }, - pages: [ - { - id: 'applicant', - title: { - id: 'event.tennis-club-membership.action.declare.form.section.who.title', - defaultMessage: 'Who is applying for the membership?', - description: 'This is the title of the section' - }, - fields: [ - { - id: 'applicant.firstname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Applicant's first name", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.firstname.label' - } - }, - { - id: 'applicant.surname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Applicant's surname", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.surname.label' - } - }, - { - id: 'applicant.dob', - type: 'DATE', - required: true, - label: { - defaultMessage: "Applicant's date of birth", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.who.field.dob.label' - } - } - ] - }, - { - id: 'recommender', - title: { - id: 'event.tennis-club-membership.action.declare.form.section.recommender.title', - defaultMessage: 'Who is recommending the applicant?', - description: 'This is the title of the section' - }, - fields: [ - { - id: 'recommender.firstname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's first name", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label' - } - }, - { - id: 'recommender.surname', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's surname", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label' - } - }, - { - id: 'recommender.id', - type: 'TEXT', - required: true, - label: { - defaultMessage: "Recommender's membership ID", - description: 'This is the label for the field', - id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.id.label' - } - } - ] - } - ] - } - ] + forms: [TENNIS_CLUB_FORM], + allowedWhen: defineConditional(not(eventHasAction('DECLARE'))) + }, + { + type: 'VALIDATE', + label: { + defaultMessage: 'Validate', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.validate.label' + }, + allowedWhen: defineConditional(eventHasAction('DECLARE')), + forms: [TENNIS_CLUB_FORM] + }, + { + type: 'REGISTER', + label: { + defaultMessage: 'Register', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.register.label' + }, + allowedWhen: defineConditional( + and( + or( + eventHasAction('VALIDATE'), + and(eventHasAction('DECLARE'), userHasScope('register')) + ), + not(eventHasAction('REGISTER')) + ) + ), + forms: [TENNIS_CLUB_FORM] + }, + { + type: 'CUSTOM', + label: { + defaultMessage: 'My custom action', + description: + 'This is shown as the action name anywhere the user can trigger the action from', + id: 'event.tennis-club-membership.action.sdf.label' + }, + allowedWhen: defineConditional( + or( + eventHasAction('VALIDATE'), + and(eventHasAction('DECLARE'), userHasScope('register')) + ) + ), + forms: [] } ] }) diff --git a/yarn.lock b/yarn.lock index 564b51c43..39488e3e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -732,10 +732,10 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@faker-js/faker@^6.0.0-alpha.5": - version "6.3.1" - resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-6.3.1.tgz#1ae963dd40405450a2945408cba553e1afa3e0fb" - integrity sha512-8YXBE2ZcU/pImVOHX7MWrSR/X5up7t6rPWZlk34RwZEcdr3ua6X+32pSd6XuOQRN+vbuvYNfA6iey8NbrjuMFQ== +"@faker-js/faker@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07" + integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw== "@formatjs/ecma402-abstract@2.2.3": version "2.2.3" @@ -1712,10 +1712,12 @@ dependencies: "@octokit/openapi-types" "^18.0.0" -"@opencrvs/toolkit@^0.0.5": - version "0.0.5" - resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.5.tgz#dbd3395b561c1eb3527b8cfc28b6e1dd301671f3" - integrity sha512-Ex45aFUJ1iQwpYGMHhxVbhpuQFqVlmdSkNXz1phkM7KAzNtngL2KGIJCc6TFv4GKOHU/lLEfmGyrhIDCKlA7fQ== +"@opencrvs/toolkit@0.0.6-events": + version "0.0.6-events" + resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-0.0.6-events.tgz#48327b3e322bc82ae60ec13fc855e2e23300b298" + integrity sha512-wh4qaPJktG4Dnh+zFFbDv5b/oZ+bTSzQYRfOzLGS1KNqG7h2j6iZfvmSBtyL0rb/SrpIHcI+9eoqLfwg8cjfyQ== + dependencies: + ajv "^8.17.1" "@parcel/watcher-android-arm64@2.5.0": version "2.5.0" @@ -2585,6 +2587,16 @@ ajv@^6.12.4: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" + integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== + dependencies: + fast-deep-equal "^3.1.3" + fast-uri "^3.0.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + ansi-escapes@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" @@ -4091,6 +4103,11 @@ fast-safe-stringify@^2.1.1: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== +fast-uri@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.3.tgz#892a1c91802d5d7860de728f18608a0573142241" + integrity sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw== + fast-url-parser@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" @@ -5183,6 +5200,11 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" @@ -6651,6 +6673,11 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" From c3f008f1f6d67b1616823b7f2be80884d855d664 Mon Sep 17 00:00:00 2001 From: Jamil Date: Fri, 20 Dec 2024 15:52:30 +0600 Subject: [PATCH 28/32] fix: bump up faker (#1191) * fix: update import from faker * chore: update faker to 9.3.0 * chore: add e2e dir in tsconfig * chore: udpate import from faker in data-generator * fix: use faker.string.numeric * fix: use faker.location instead of faker.address * fix: update faker api calls * fix: import node from node-fetch * fix: type errors in e2e --- e2e/helpers.ts | 1 + ...ct-a-record-from-audit-record-page.spec.ts | 14 ++-- .../birth/1-birth-event-declaration.spec.ts | 14 ++-- ...8-validate-declaration-review-page.spec.ts | 36 ++++----- .../declarations/birth-declaration-1.spec.ts | 16 ++-- .../declarations/birth-declaration-10.spec.ts | 4 +- .../declarations/birth-declaration-2.spec.ts | 40 ++++----- .../declarations/birth-declaration-3.spec.ts | 52 ++++++------ .../declarations/birth-declaration-4.spec.ts | 60 +++++++------- .../declarations/birth-declaration-5.spec.ts | 46 +++++------ .../declarations/birth-declaration-6.spec.ts | 56 ++++++------- .../declarations/birth-declaration-7.spec.ts | 6 +- .../declarations/birth-declaration-9.spec.ts | 4 +- e2e/testcases/birth/helpers.ts | 35 ++++---- .../correct-birth-record-1.spec.ts | 18 ++--- .../correct-birth-record-2.spec.ts | 40 ++++----- .../correct-birth-record-3.spec.ts | 40 ++++----- .../correct-birth-record-4.spec.ts | 30 +++---- .../correct-birth-record-5.spec.ts | 28 +++---- .../correct-birth-record-6.spec.ts | 30 +++---- .../correct-birth-record-7.spec.ts | 30 +++---- .../correct-birth-record-8.spec.ts | 30 +++---- .../correct-birth-record-9.spec.ts | 30 +++---- .../correct-death-record-10.spec.ts | 18 ++--- .../correct-death-record-12.spec.ts | 28 +++---- .../correct-death-record-13.spec.ts | 18 ++--- .../correct-death-record-14.spec.ts | 18 ++--- .../correct-death-record-16.spec.ts | 18 ++--- .../correct-death-record-17.spec.ts | 18 ++--- .../correct-death-record-18.spec.ts | 18 ++--- ...8-validate-declaration-review-page.spec.ts | 38 ++++----- .../declaration/death-declaration-1.spec.ts | 24 +++--- .../declaration/death-declaration-11.spec.ts | 62 +++++++------- .../declaration/death-declaration-2.spec.ts | 32 ++++---- .../declaration/death-declaration-3.spec.ts | 46 +++++------ .../declaration/death-declaration-4.spec.ts | 46 +++++------ .../declaration/death-declaration-5.spec.ts | 48 +++++------ .../declaration/death-declaration-6.spec.ts | 40 ++++----- .../declaration/death-declaration-7.spec.ts | 52 ++++++------ .../declaration/death-declaration-8.spec.ts | 6 +- .../declaration/death-declaration-9.spec.ts | 4 +- e2e/testcases/death/helpers.ts | 25 +++--- package.json | 5 +- src/data-generator/address.ts | 8 +- src/data-generator/declare.ts | 81 ++++++++++--------- src/data-generator/users.ts | 10 +-- tsconfig.json | 12 ++- yarn.lock | 13 ++- 48 files changed, 684 insertions(+), 664 deletions(-) diff --git a/e2e/helpers.ts b/e2e/helpers.ts index 01e835b9a..8f37aa543 100644 --- a/e2e/helpers.ts +++ b/e2e/helpers.ts @@ -8,6 +8,7 @@ import { } from './constants' import { format, parseISO } from 'date-fns' import { isArray, random } from 'lodash' +import fetch from 'node-fetch' export async function login(page: Page, username: string, password: string) { const token = await getToken(username, password) diff --git a/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts b/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts index 020040d3c..7d4eecc20 100644 --- a/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts +++ b/e2e/testcases/applications/17-validate-user-can-correct-a-record-from-audit-record-page.spec.ts @@ -6,7 +6,7 @@ import { getToken, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { createDeclaration } from '../birth/helpers' import TEST_DATA_1 from '../birth/data/1-both-mother-and-father.json' import { CREDENTIALS } from '../../constants' @@ -25,8 +25,8 @@ test.describe const token = await getToken('k.mweene', 'test') const res = await createDeclaration(token, { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: TEST_DATA_1['Child details'].Sex.toLowerCase() as 'male' }, informant: { @@ -40,12 +40,12 @@ test.describe ].toUpperCase() as 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } }) expect(res).toStrictEqual({ diff --git a/e2e/testcases/birth/1-birth-event-declaration.spec.ts b/e2e/testcases/birth/1-birth-event-declaration.spec.ts index 99107e4e0..78426dfaf 100644 --- a/e2e/testcases/birth/1-birth-event-declaration.spec.ts +++ b/e2e/testcases/birth/1-birth-event-declaration.spec.ts @@ -3,7 +3,7 @@ import { createPIN, getToken, login } from '../../helpers' import { createDeclaration } from './helpers' import TEST_DATA_1 from './data/1-both-mother-and-father.json' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe('1. Birth event declaration', () => { @@ -569,8 +569,8 @@ test.describe('1. Birth event declaration', () => { const token = await getToken('k.mweene', 'test') const res = await createDeclaration(token, { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: TEST_DATA_1['Child details'].Sex.toLowerCase() as 'male' }, informant: { @@ -584,12 +584,12 @@ test.describe('1. Birth event declaration', () => { ].toUpperCase() as 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } }) expect(res).toStrictEqual({ diff --git a/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts b/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts index e1035c0eb..26294d50f 100644 --- a/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/birth/8-validate-declaration-review-page.spec.ts @@ -12,7 +12,7 @@ import { getAction, assignRecord } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe.serial('8. Validate declaration review page', () => { @@ -20,8 +20,8 @@ test.describe.serial('8. Validate declaration review page', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(0, 200) @@ -35,13 +35,13 @@ test.describe.serial('8. Validate declaration review page', () => { informantEmail: faker.internet.email(), mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -52,13 +52,13 @@ test.describe.serial('8. Validate declaration review page', () => { }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: 'Same as mother' @@ -422,8 +422,8 @@ test.describe.serial('8. Validate declaration review page', () => { await page.locator('#child-content #Full').getByText('Change').click() declaration.child.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -612,8 +612,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.10 Change mother's name", async () => { await page.locator('#mother-content #Full').getByText('Change').click() - declaration.mother.name.firstNames = faker.name.firstName('female') - declaration.mother.name.familyName = faker.name.lastName('female') + declaration.mother.name.firstNames = faker.person.firstName('female') + declaration.mother.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.mother.name.firstNames) @@ -695,7 +695,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.14 Change mother's ID", async () => { await page.locator('#mother-content #ID').getByText('Change').click() - declaration.mother.identifier.id = faker.random.numeric(10) + declaration.mother.identifier.id = faker.string.numeric(10) await page .locator('#motherPassport') .fill(declaration.mother.identifier.id) @@ -738,8 +738,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.16 Change father's name", async () => { await page.locator('#father-content #Full').getByText('Change').click() - declaration.father.name.firstNames = faker.name.firstName('male') - declaration.father.name.familyName = faker.name.lastName('male') + declaration.father.name.firstNames = faker.person.firstName('male') + declaration.father.name.familyName = faker.person.lastName('male') await page .locator('#firstNamesEng') .fill(declaration.father.name.firstNames) @@ -821,7 +821,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.20 Change father's ID", async () => { await page.locator('#father-content #ID').getByText('Change').click() - declaration.father.identifier.id = faker.random.numeric(10) + declaration.father.identifier.id = faker.string.numeric(10) await page .locator('#fatherPassport') .fill(declaration.father.identifier.id) @@ -1349,7 +1349,7 @@ test.describe.serial('8. Validate declaration review page', () => { ]) }) - const newFamilyNameForChild = faker.name.lastName('male') + const newFamilyNameForChild = faker.person.lastName('male') test("8.3.2.1 Update child's family name", async () => { await page diff --git a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts index 2ca50b831..6a076a514 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-1.spec.ts @@ -12,7 +12,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('1. Birth declaration case - 1', () => { @@ -41,7 +41,7 @@ test.describe.serial('1. Birth declaration case - 1', () => { birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -49,11 +49,11 @@ test.describe.serial('1. Birth declaration case - 1', () => { province: 'Sulaka', district: 'Irundu', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Single', levelOfEducation: 'No schooling' @@ -66,7 +66,7 @@ test.describe.serial('1. Birth declaration case - 1', () => { birthDate: getRandomDate(22, 200), nationality: 'Gabon', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, maritalStatus: 'Single', diff --git a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts index b04099944..ef7a4f7df 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-10.spec.ts @@ -9,7 +9,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('10. Birth declaration case - 10', () => { @@ -18,7 +18,7 @@ test.describe.serial('10. Birth declaration case - 10', () => { const declaration = { child: { name: { - firstNames: faker.name.lastName() + firstNames: faker.person.lastName() } }, informantType: 'Father', diff --git a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts index 2834454fd..32fbaeb6f 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-2.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('2. Birth declaration case - 2', () => { @@ -21,8 +21,8 @@ test.describe.serial('2. Birth declaration case - 2', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', birthDate: getRandomDate(0, 200) @@ -35,23 +35,23 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Father', informantEmail: faker.internet.email(), mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 21, nationality: 'Fiji', identifier: { - id: faker.random.numeric(12), + id: faker.string.numeric(12), type: 'Passport' }, address: { @@ -59,20 +59,20 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Sulaka', district: 'Irundu', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, maritalStatus: 'Married', levelOfEducation: 'Primary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 25, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(8), + id: faker.string.numeric(8), type: 'Passport' }, maritalStatus: 'Married', @@ -83,11 +83,11 @@ test.describe.serial('2. Birth declaration case - 2', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts index eebf06888..f99b5ea8a 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-3.spec.ts @@ -14,7 +14,7 @@ import { uploadImage, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('3. Birth declaration case - 3', () => { @@ -22,8 +22,8 @@ test.describe.serial('3. Birth declaration case - 3', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + '_Peter', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + '_Peter', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -36,19 +36,19 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, informantType: 'Grandfather', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(40, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -56,46 +56,46 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Chuminga', district: 'Ama', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(20, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(9), + id: faker.string.numeric(9), type: 'Birth Registration Number' }, address: { country: 'Djibouti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Widowed', levelOfEducation: 'Secondary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Gabon', identifier: { - id: faker.random.numeric(11), + id: faker.string.numeric(11), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', @@ -106,7 +106,7 @@ test.describe.serial('3. Birth declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts index 7e7cedf46..f216d855e 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-4.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('4. Birth declaration case - 4', () => { @@ -21,8 +21,8 @@ test.describe.serial('4. Birth declaration case - 4', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + '-Peter', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + '-Peter', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -35,23 +35,23 @@ test.describe.serial('4. Birth declaration case - 4', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Grandmother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 60, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -59,13 +59,13 @@ test.describe.serial('4. Birth declaration case - 4', () => { province: 'Chuminga', district: 'Ama', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 25, nationality: 'Farajaland', @@ -74,21 +74,21 @@ test.describe.serial('4. Birth declaration case - 4', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Divorced', levelOfEducation: 'Tertiary' }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(22, 200), nationality: 'Farajaland', @@ -100,13 +100,13 @@ test.describe.serial('4. Birth declaration case - 4', () => { address: { sameAsMother: false, country: 'Grenada', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts index 65bf0a713..1e37bffed 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-5.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('5. Birth declaration case - 5', () => { @@ -19,8 +19,8 @@ test.describe.serial('5. Birth declaration case - 5', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + ' the 3rd', - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + ' the 3rd', + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -33,36 +33,36 @@ test.describe.serial('5. Birth declaration case - 5', () => { province: 'Pualula', district: 'Funabuli', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() }, informantType: 'Brother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 16, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { country: 'Haiti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, mother: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 25, nationality: 'Farajaland', @@ -71,13 +71,13 @@ test.describe.serial('5. Birth declaration case - 5', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Separated', levelOfEducation: 'Tertiary' diff --git a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts index e834b27f7..112ade170 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-6.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('6. Birth declaration case - 6', () => { @@ -19,8 +19,8 @@ test.describe.serial('6. Birth declaration case - 6', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName() + " O'Neil", - familyName: faker.name.lastName() + firstNames: faker.person.firstName() + " O'Neil", + familyName: faker.person.lastName() }, gender: 'Unknown', birthDate: getRandomDate(0, 200) @@ -30,20 +30,20 @@ test.describe.serial('6. Birth declaration case - 6', () => { placeOfBirth: 'Other', birthLocation: { country: 'Greenland', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, informantType: 'Sister', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 17, nationality: 'Guernsey', @@ -52,19 +52,19 @@ test.describe.serial('6. Birth declaration case - 6', () => { }, address: { country: 'Haiti', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, father: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 25, nationality: 'Farajaland', @@ -73,13 +73,13 @@ test.describe.serial('6. Birth declaration case - 6', () => { }, address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() }, maritalStatus: 'Separated', levelOfEducation: 'Tertiary' diff --git a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts index e05dd0537..8d8156521 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-7.spec.ts @@ -11,7 +11,7 @@ import { uploadImage, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('7. Birth declaration case - 7', () => { @@ -20,8 +20,8 @@ test.describe.serial('7. Birth declaration case - 7', () => { const declaration = { child: { name: { - firstNames: faker.name.firstName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } }, attendantAtBirth: 'None', diff --git a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts index 9148afeb3..ecd28a25b 100644 --- a/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts +++ b/e2e/testcases/birth/declarations/birth-declaration-9.spec.ts @@ -9,7 +9,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('9. Birth declaration case - 9', () => { @@ -18,7 +18,7 @@ test.describe.serial('9. Birth declaration case - 9', () => { const declaration = { child: { name: { - familyName: faker.name.lastName() + familyName: faker.person.lastName() } }, informantType: 'Mother', diff --git a/e2e/testcases/birth/helpers.ts b/e2e/testcases/birth/helpers.ts index bd4dd6d76..a2f83fe8c 100644 --- a/e2e/testcases/birth/helpers.ts +++ b/e2e/testcases/birth/helpers.ts @@ -1,6 +1,6 @@ import { GATEWAY_HOST } from '../../constants' import { BirthRegistrationInput } from '../../gateway' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { readFileSync } from 'fs' import uuid from 'uuid' @@ -13,6 +13,7 @@ import { } from './queries' import { random } from 'lodash' import { generateRandomSuffix } from '../../helpers' +import fetch from 'node-fetch' export type BirthDetails = { informant: { @@ -92,7 +93,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { join(__dirname, './data/assets/528KB-random.png') ).toString('base64'), informantType: details.informant.type, - contactPhoneNumber: '0' + faker.random.numeric(9), + contactPhoneNumber: '0' + faker.string.numeric(9), contactEmail: faker.internet.email(), draftId: uuid.v4() }, @@ -120,9 +121,9 @@ export async function createDeclaration(token: string, details: BirthDetails) { type: 'PRIVATE_HOME', address: { line: [ - faker.address.buildingNumber(), - faker.address.streetName(), - faker.address.cityName(), + faker.location.buildingNumber(), + faker.location.street(), + faker.location.city(), '', '', 'URBAN', @@ -141,8 +142,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { locations, details.child.birthLocation?.district || 'Ibombo' ), - city: faker.address.cityName(), - postalCode: faker.address.zipCode() + city: faker.location.city(), + postalCode: faker.location.zipCode() } } : { @@ -166,7 +167,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], @@ -174,9 +175,9 @@ export async function createDeclaration(token: string, details: BirthDetails) { { type: 'PRIMARY_ADDRESS', line: [ - faker.address.buildingNumber(), - faker.address.streetName(), - faker.address.cityName(), + faker.location.buildingNumber(), + faker.location.street(), + faker.location.city(), '', '', 'URBAN', @@ -220,8 +221,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { name: [ { use: 'en', - firstNames: faker.name.findName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } ], birthDate: @@ -233,7 +234,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], @@ -272,8 +273,8 @@ export async function createDeclaration(token: string, details: BirthDetails) { name: [ { use: 'en', - firstNames: faker.name.findName(), - familyName: faker.name.lastName() + firstNames: faker.person.firstName(), + familyName: faker.person.lastName() } ], birthDate: format( @@ -283,7 +284,7 @@ export async function createDeclaration(token: string, details: BirthDetails) { nationality: ['FAR'], identifier: [ { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' } ], diff --git a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts index dc5658aaa..86f5cdca8 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-1.spec.ts @@ -15,7 +15,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -30,8 +30,8 @@ test.describe('1. Correct record - 1', () => { let trackingId = '' const updatedChildDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', birthDate: format( subDays(new Date(), Math.ceil(10 * Math.random())), @@ -47,8 +47,8 @@ test.describe('1. Correct record - 1', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -58,12 +58,12 @@ test.describe('1. Correct record - 1', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts index 9d717f130..b6bef5121 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-2.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -31,24 +31,24 @@ test.describe.serial('Correct record - 2', () => { const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } const updatedChildDetails = { @@ -56,11 +56,11 @@ test.describe.serial('Correct record - 2', () => { birthLocation: { province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -76,8 +76,8 @@ test.describe.serial('Correct record - 2', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -87,12 +87,12 @@ test.describe.serial('Correct record - 2', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts index e91bbbb93..5bb865e77 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-3.spec.ts @@ -12,7 +12,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -29,21 +29,21 @@ test.describe.serial(' Correct record - 3', () => { let page: Page const updatedMotherDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), age: random(20, 45), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -53,11 +53,11 @@ test.describe.serial(' Correct record - 3', () => { birthLocation: { province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -73,8 +73,8 @@ test.describe.serial(' Correct record - 3', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -84,12 +84,12 @@ test.describe.serial(' Correct record - 3', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts index 86e339be2..2473e4412 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-4.spec.ts @@ -14,7 +14,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -31,24 +31,24 @@ test.describe.serial(' Correct record - 4', () => { let page: Page const updatedFatherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -71,8 +71,8 @@ test.describe.serial(' Correct record - 4', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male', placeOfBirth: 'Residential address', birthLocation: { @@ -87,12 +87,12 @@ test.describe.serial(' Correct record - 4', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts index 65a7cd968..0a138ade7 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-5.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { BirthDetails, ConvertEnumsToStrings, @@ -30,8 +30,8 @@ test.describe.serial(' Correct record - 5', () => { let page: Page const updatedChildDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', birthDate: format( subDays(new Date(), Math.ceil(10 * Math.random())), @@ -41,11 +41,11 @@ test.describe.serial(' Correct record - 5', () => { birthLocation: { state: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, attendantAtBirth: 'Nurse', typeOfBirth: 'Twin', @@ -65,8 +65,8 @@ test.describe.serial(' Correct record - 5', () => { let token = await getToken('k.mweene', 'test') declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male', placeOfBirth: 'Residential address', birthLocation: { @@ -81,12 +81,12 @@ test.describe.serial(' Correct record - 5', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts index 01d1c2b9b..8efaba603 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-6.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 6', () => { let page: Page const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -61,8 +61,8 @@ test.describe.serial(' Correct record - 6', () => { let token = await getToken('k.mweene', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -72,12 +72,12 @@ test.describe.serial(' Correct record - 6', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts index 3cbb2f0c5..fc5b1d52f 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-7.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -30,21 +30,21 @@ test.describe.serial(' Correct record - 7', () => { let page: Page const updatedMotherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), age: random(20, 45), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -62,8 +62,8 @@ test.describe.serial(' Correct record - 7', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -73,12 +73,12 @@ test.describe.serial(' Correct record - 7', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts index 24eb14351..bc6718b4d 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-8.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 8', () => { let page: Page const updatedFatherDetails = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.firstName('male'), + firstNames: faker.person.firstName('male'), + familyName: faker.person.firstName('male'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', educationLevel: 'Primary' @@ -63,8 +63,8 @@ test.describe.serial(' Correct record - 8', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -74,12 +74,12 @@ test.describe.serial(' Correct record - 8', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts b/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts index c73b0d924..2e5d5ae7a 100644 --- a/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts +++ b/e2e/testcases/correction-birth/correct-birth-record-9.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { ConvertEnumsToStrings, createDeclaration, @@ -28,24 +28,24 @@ test.describe.serial(' Correct record - 9', () => { let page: Page const updatedInformantDetails = { relationship: 'Sister', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subYears(new Date(), 25 + Math.ceil(10 * Math.random())), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -61,8 +61,8 @@ test.describe.serial(' Correct record - 9', () => { let token = await getToken('j.musonda', 'test') const declarationInput = { child: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName(), + firstNames: faker.person.firstName(), + familyName: faker.person.firstName(), gender: 'male' }, informant: { @@ -72,12 +72,12 @@ test.describe.serial(' Correct record - 9', () => { type: 'PHYSICIAN' }, mother: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() }, father: { - firstNames: faker.name.firstName(), - familyName: faker.name.firstName() + firstNames: faker.person.firstName(), + familyName: faker.person.firstName() } } as ConvertEnumsToStrings diff --git a/e2e/testcases/correction-death/correct-death-record-10.spec.ts b/e2e/testcases/correction-death/correct-death-record-10.spec.ts index 0f2ac71a5..c19be363a 100644 --- a/e2e/testcases/correction-death/correct-death-record-10.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-10.spec.ts @@ -15,7 +15,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, parseISO } from 'date-fns' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { DeathDeclaration } from '../death/types' @@ -27,21 +27,21 @@ test.describe('10. Correct record - 10', () => { let trackingId = '' const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3' diff --git a/e2e/testcases/correction-death/correct-death-record-12.spec.ts b/e2e/testcases/correction-death/correct-death-record-12.spec.ts index 2c2ca8048..6615b3ebd 100644 --- a/e2e/testcases/correction-death/correct-death-record-12.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-12.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, parseISO, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { @@ -31,26 +31,26 @@ test.describe.serial(' Correct record - 12', () => { const updatedInformantDetails = { type: 'Son', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, country: 'Farajaland', province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } @@ -59,11 +59,11 @@ test.describe.serial(' Correct record - 12', () => { deathLocation: { province: 'Chuminga', district: 'Soka', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-13.spec.ts b/e2e/testcases/correction-death/correct-death-record-13.spec.ts index 7cd487ef5..478a46bfe 100644 --- a/e2e/testcases/correction-death/correct-death-record-13.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-13.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { @@ -33,25 +33,25 @@ test.describe.serial(' Correct record - 13', () => { let declarationInput: DeathDeclarationInput const updatedSpouseDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-14.spec.ts b/e2e/testcases/correction-death/correct-death-record-14.spec.ts index 365bfd748..0c1fab52d 100644 --- a/e2e/testcases/correction-death/correct-death-record-14.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-14.spec.ts @@ -12,7 +12,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' @@ -24,21 +24,21 @@ test.describe.serial(' Correct record - 14', () => { let page: Page const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3', diff --git a/e2e/testcases/correction-death/correct-death-record-16.spec.ts b/e2e/testcases/correction-death/correct-death-record-16.spec.ts index 88f067d93..bcfe6657c 100644 --- a/e2e/testcases/correction-death/correct-death-record-16.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-16.spec.ts @@ -13,7 +13,7 @@ import { uploadImage, uploadImageToSection } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' @@ -26,26 +26,26 @@ test.describe.serial(' Correct record - 16', () => { let page: Page const updatedInformantDetails = { type: 'Son', - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, country: 'Farajaland', province: 'Sulaka', district: 'Irundu', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-17.spec.ts b/e2e/testcases/correction-death/correct-death-record-17.spec.ts index b918e4e3a..f52ae1300 100644 --- a/e2e/testcases/correction-death/correct-death-record-17.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-17.spec.ts @@ -11,7 +11,7 @@ import { goBackToReview, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { format, subDays } from 'date-fns' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' @@ -24,25 +24,25 @@ test.describe.serial(' Correct record - 17', () => { let page: Page const updatedSpouseDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), birthDate: format( subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)), 'yyyy-MM-dd' ), email: faker.internet.email(), nationality: 'Nauru', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { sameAsDeceased: false, province: 'Pualula', district: 'Ienge', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() } } diff --git a/e2e/testcases/correction-death/correct-death-record-18.spec.ts b/e2e/testcases/correction-death/correct-death-record-18.spec.ts index e2323638c..aa0747a73 100644 --- a/e2e/testcases/correction-death/correct-death-record-18.spec.ts +++ b/e2e/testcases/correction-death/correct-death-record-18.spec.ts @@ -11,7 +11,7 @@ import { joinValuesWith, login } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { DeathDeclaration } from '../death/types' import { createDeathDeclaration, fetchDeclaration } from '../death/helpers' import { CREDENTIALS } from '../../constants' @@ -23,21 +23,21 @@ test.describe.serial(' Correct record - 18', () => { let page: Page const updatedDeceasedDetails = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.firstName('female'), + firstNames: faker.person.firstName('female'), + familyName: faker.person.firstName('female'), gender: 'Female', age: random(20, 45), nationality: 'Canada', - id: faker.random.numeric(10), + id: faker.string.numeric(10), idType: 'Passport', address: { province: 'Pualula', district: 'Pili', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - zipCode: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + zipCode: faker.location.zipCode() }, maritalStatus: 'Married', NOdependants: '3' diff --git a/e2e/testcases/death/8-validate-declaration-review-page.spec.ts b/e2e/testcases/death/8-validate-declaration-review-page.spec.ts index 49f4f66c6..0d1899859 100644 --- a/e2e/testcases/death/8-validate-declaration-review-page.spec.ts +++ b/e2e/testcases/death/8-validate-declaration-review-page.spec.ts @@ -13,7 +13,7 @@ import { getAction, assignRecord } from '../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../constants' test.describe.serial('8. Validate declaration review page', () => { @@ -21,14 +21,14 @@ test.describe.serial('8. Validate declaration review page', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(75, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -49,13 +49,13 @@ test.describe.serial('8. Validate declaration review page', () => { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -364,8 +364,8 @@ test.describe.serial('8. Validate declaration review page', () => { .getByText('Change') .click() declaration.deceased.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -448,7 +448,7 @@ test.describe.serial('8. Validate declaration review page', () => { }) test("8.1.2.5 Change deceased's ID", async () => { await page.locator('#deceased-content #ID').getByText('Change').click() - declaration.deceased.identifier.id = faker.random.numeric(10) + declaration.deceased.identifier.id = faker.string.numeric(10) await page .locator('#deceasedPassport') .fill(declaration.deceased.identifier.id) @@ -530,8 +530,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.1.2.9 Change spouse's name", async () => { await page.locator('#spouse-content #Full').getByText('Change').click() - declaration.spouse.name.firstNames = faker.name.firstName('female') - declaration.spouse.name.familyName = faker.name.lastName('female') + declaration.spouse.name.firstNames = faker.person.firstName('female') + declaration.spouse.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.spouse.name.firstNames) @@ -602,7 +602,7 @@ test.describe.serial('8. Validate declaration review page', () => { }) test("8.1.2.13 Change spouse's ID", async () => { await page.locator('#spouse-content #ID').getByText('Change').click() - declaration.spouse.identifier.id = faker.random.numeric(10) + declaration.spouse.identifier.id = faker.string.numeric(10) await page .locator('#spousePassport') .fill(declaration.spouse.identifier.id) @@ -897,8 +897,8 @@ test.describe.serial('8. Validate declaration review page', () => { await page.getByRole('button', { name: 'Continue' }).click() declaration.deceased.name = { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') } await page .locator('#firstNamesEng') @@ -986,7 +986,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.5 Change deceased's ID", async () => { await page.locator('#deceased-content #ID').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.deceased.identifier.id = faker.random.numeric(10) + declaration.deceased.identifier.id = faker.string.numeric(10) await page .locator('#deceasedBirthRegistrationNumber') .fill(declaration.deceased.identifier.id) @@ -1075,8 +1075,8 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.9 Change spouse's name", async () => { await page.locator('#spouse-content #Full').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.spouse.name.firstNames = faker.name.firstName('female') - declaration.spouse.name.familyName = faker.name.lastName('female') + declaration.spouse.name.firstNames = faker.person.firstName('female') + declaration.spouse.name.familyName = faker.person.lastName('female') await page .locator('#firstNamesEng') .fill(declaration.spouse.name.firstNames) @@ -1151,7 +1151,7 @@ test.describe.serial('8. Validate declaration review page', () => { test("8.2.2.13 Change spouse's ID", async () => { await page.locator('#spouse-content #ID').getByText('Change').click() await page.getByRole('button', { name: 'Continue' }).click() - declaration.spouse.identifier.id = faker.random.numeric(10) + declaration.spouse.identifier.id = faker.string.numeric(10) await page .locator('#spouseBirthRegistrationNumber') .fill(declaration.spouse.identifier.id) diff --git a/e2e/testcases/death/declaration/death-declaration-1.spec.ts b/e2e/testcases/death/declaration/death-declaration-1.spec.ts index 579ba5738..d60e9af5e 100644 --- a/e2e/testcases/death/declaration/death-declaration-1.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-1.spec.ts @@ -12,7 +12,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('1. Death declaration case - 1', () => { @@ -20,14 +20,14 @@ test.describe.serial('1. Death declaration case - 1', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Male', birthDate: getRandomDate(75, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, maritalStatus: 'Single', @@ -37,11 +37,11 @@ test.describe.serial('1. Death declaration case - 1', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('1. Death declaration case - 1', () => { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { diff --git a/e2e/testcases/death/declaration/death-declaration-11.spec.ts b/e2e/testcases/death/declaration/death-declaration-11.spec.ts index 0b069303c..0a58b121e 100644 --- a/e2e/testcases/death/declaration/death-declaration-11.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-11.spec.ts @@ -14,7 +14,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('11. Death declaration case - 11', () => { @@ -22,26 +22,26 @@ test.describe.serial('11. Death declaration case - 11', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, gender: 'Unknown', age: 45, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -58,14 +58,14 @@ test.describe.serial('11. Death declaration case - 11', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 17, birthDate: getRandomDate(5, 200), nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -74,22 +74,22 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -98,7 +98,7 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } @@ -619,8 +619,8 @@ test.describe.serial('11. Death declaration case - 11', () => { .getByText('Change') .click() declaration.informant.name = { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') } expect(page.url().includes('informant')).toBeTruthy() await page @@ -689,7 +689,7 @@ test.describe.serial('11. Death declaration case - 11', () => { test("11.1.7.4 Change informant's ID", async () => { await page.locator('#informant-content #ID').getByText('Change').click() expect(page.url().includes('informant')).toBeTruthy() - declaration.informant.identifier.id = faker.random.numeric(10) + declaration.informant.identifier.id = faker.string.numeric(10) await page .locator('#informantBirthRegistrationNumber') .fill(declaration.informant.identifier.id) @@ -713,11 +713,11 @@ test.describe.serial('11. Death declaration case - 11', () => { province: 'Sulaka', district: 'Afue', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } await page.locator('#statePrimaryInformant').click() await page diff --git a/e2e/testcases/death/declaration/death-declaration-2.spec.ts b/e2e/testcases/death/declaration/death-declaration-2.spec.ts index 5e080faf9..e952d8a36 100644 --- a/e2e/testcases/death/declaration/death-declaration-2.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-2.spec.ts @@ -14,7 +14,7 @@ import { login, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('2. Death declaration case - 2', () => { @@ -22,14 +22,14 @@ test.describe.serial('2. Death declaration case - 2', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', age: 65, nationality: 'Guernsey', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, maritalStatus: 'Married', @@ -38,7 +38,7 @@ test.describe.serial('2. Death declaration case - 2', () => { province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, event: { @@ -55,13 +55,13 @@ test.describe.serial('2. Death declaration case - 2', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, birthDate: getRandomDate(50, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'National ID' }, address: { @@ -70,13 +70,13 @@ test.describe.serial('2. Death declaration case - 2', () => { }, spouse: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 68, nationality: 'Canada', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -85,11 +85,11 @@ test.describe.serial('2. Death declaration case - 2', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-3.spec.ts b/e2e/testcases/death/declaration/death-declaration-3.spec.ts index 888e60ff5..6ab35d4d6 100644 --- a/e2e/testcases/death/declaration/death-declaration-3.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-3.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('3. Death declaration case - 3', () => { @@ -21,26 +21,26 @@ test.describe.serial('3. Death declaration case - 3', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + ' the 2nd', - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male') + ' the 2nd', + familyName: faker.person.lastName('male') }, gender: 'Unknown', age: 45, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, maritalStatus: 'Widowed', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('3. Death declaration case - 3', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Passport' }, address: { @@ -72,22 +72,22 @@ test.describe.serial('3. Death declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -96,7 +96,7 @@ test.describe.serial('3. Death declaration case - 3', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-4.spec.ts b/e2e/testcases/death/declaration/death-declaration-4.spec.ts index 8bfa9338f..210f5910c 100644 --- a/e2e/testcases/death/declaration/death-declaration-4.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-4.spec.ts @@ -14,7 +14,7 @@ import { login, uploadImageToSection } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('4. Death declaration case - 4', () => { @@ -22,8 +22,8 @@ test.describe.serial('4. Death declaration case - 4', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + '_Nolas', - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + '_Nolas', + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -34,13 +34,13 @@ test.describe.serial('4. Death declaration case - 4', () => { maritalStatus: 'Divorced', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -57,13 +57,13 @@ test.describe.serial('4. Death declaration case - 4', () => { informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'Birth Registration Number' }, address: { @@ -72,13 +72,13 @@ test.describe.serial('4. Death declaration case - 4', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, age: 42, nationality: 'Farajaland', @@ -88,13 +88,13 @@ test.describe.serial('4. Death declaration case - 4', () => { address: { sameAsDeceased: false, country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } } } diff --git a/e2e/testcases/death/declaration/death-declaration-5.spec.ts b/e2e/testcases/death/declaration/death-declaration-5.spec.ts index 43bbf9bca..37a5a621d 100644 --- a/e2e/testcases/death/declaration/death-declaration-5.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-5.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('5. Death declaration case - 5', () => { @@ -21,8 +21,8 @@ test.describe.serial('5. Death declaration case - 5', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + '-Peter', - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + '-Peter', + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -33,13 +33,13 @@ test.describe.serial('5. Death declaration case - 5', () => { maritalStatus: 'Separated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -54,19 +54,19 @@ test.describe.serial('5. Death declaration case - 5', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, informantType: 'Daughter in law', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -76,13 +76,13 @@ test.describe.serial('5. Death declaration case - 5', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-6.spec.ts b/e2e/testcases/death/declaration/death-declaration-6.spec.ts index 6257fb992..2d5a90646 100644 --- a/e2e/testcases/death/declaration/death-declaration-6.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-6.spec.ts @@ -14,7 +14,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('6. Death declaration case - 6', () => { @@ -22,8 +22,8 @@ test.describe.serial('6. Death declaration case - 6', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female') + " O'Nila", - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female') + " O'Nila", + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -34,13 +34,13 @@ test.describe.serial('6. Death declaration case - 6', () => { maritalStatus: 'Not stated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -55,15 +55,15 @@ test.describe.serial('6. Death declaration case - 6', () => { province: 'Chuminga', district: 'Nsali', urbanOrRural: 'Rural', - village: faker.address.county() + village: faker.location.county() } }, informantType: 'Mother', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -73,13 +73,13 @@ test.describe.serial('6. Death declaration case - 6', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-7.spec.ts b/e2e/testcases/death/declaration/death-declaration-7.spec.ts index f4433803a..f1eb7d7a8 100644 --- a/e2e/testcases/death/declaration/death-declaration-7.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-7.spec.ts @@ -13,7 +13,7 @@ import { joinValuesWith, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('7. Death declaration case - 7', () => { @@ -21,8 +21,8 @@ test.describe.serial('7. Death declaration case - 7', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, gender: 'Female', age: 45, @@ -33,13 +33,13 @@ test.describe.serial('7. Death declaration case - 7', () => { maritalStatus: 'Not stated', address: { country: 'Guam', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -51,21 +51,21 @@ test.describe.serial('7. Death declaration case - 7', () => { place: 'Other', deathLocation: { country: 'Germany', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, informantType: 'Father', informantEmail: faker.internet.email(), informant: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, age: 17, nationality: 'Malawi', @@ -75,13 +75,13 @@ test.describe.serial('7. Death declaration case - 7', () => { address: { sameAsDeceased: false, country: 'Comoros', - state: faker.address.state(), - district: faker.address.county(), - town: faker.address.city(), - addressLine1: faker.address.county(), - addressLine2: faker.address.streetName(), - addressLine3: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + state: faker.location.state(), + district: faker.location.county(), + town: faker.location.city(), + addressLine1: faker.location.county(), + addressLine2: faker.location.street(), + addressLine3: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, spouse: { diff --git a/e2e/testcases/death/declaration/death-declaration-8.spec.ts b/e2e/testcases/death/declaration/death-declaration-8.spec.ts index 3e7bf135d..62457236c 100644 --- a/e2e/testcases/death/declaration/death-declaration-8.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-8.spec.ts @@ -10,7 +10,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('8. Death declaration case - 8', () => { @@ -19,8 +19,8 @@ test.describe.serial('8. Death declaration case - 8', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male'), - familyName: faker.name.lastName('male') + firstNames: faker.person.firstName('male'), + familyName: faker.person.lastName('male') }, address: { country: 'Farajaland', diff --git a/e2e/testcases/death/declaration/death-declaration-9.spec.ts b/e2e/testcases/death/declaration/death-declaration-9.spec.ts index de71a3e76..e41bbe485 100644 --- a/e2e/testcases/death/declaration/death-declaration-9.spec.ts +++ b/e2e/testcases/death/declaration/death-declaration-9.spec.ts @@ -10,7 +10,7 @@ import { goToSection, login } from '../../../helpers' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { CREDENTIALS } from '../../../constants' test.describe.serial('9. Death declaration case - 9', () => { @@ -19,7 +19,7 @@ test.describe.serial('9. Death declaration case - 9', () => { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + firstNames: faker.person.firstName('male') }, address: { country: 'Farajaland', diff --git a/e2e/testcases/death/helpers.ts b/e2e/testcases/death/helpers.ts index 13e532551..806b6855e 100644 --- a/e2e/testcases/death/helpers.ts +++ b/e2e/testcases/death/helpers.ts @@ -1,6 +1,6 @@ import { GATEWAY_HOST } from '../../constants' import { DeathRegistrationInput } from '../../gateway' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { readFileSync } from 'fs' import uuid from 'uuid' @@ -15,6 +15,7 @@ import { GET_DEATH_REGISTRATION_FOR_REVIEW } from './queries' import { random } from 'lodash' +import fetch from 'node-fetch' export type DeathDeclarationInput = { deceased?: { @@ -35,26 +36,26 @@ export type DeathDeclarationInput = { const declaration = { deceased: { name: { - firstNames: faker.name.firstName('male') + generateRandomSuffix(), - familyName: faker.name.lastName('male') + generateRandomSuffix() + firstNames: faker.person.firstName('male') + generateRandomSuffix(), + familyName: faker.person.lastName('male') + generateRandomSuffix() }, gender: 'male', age: random(50, 100), nationality: 'FAR', identifier: { type: 'NATIONAL_ID', - id: faker.random.numeric(10) + id: faker.string.numeric(10) }, address: { country: 'FAR', province: 'Sulaka', district: 'Zobwe', urbanOrRural: 'Urban', - town: faker.address.city(), - residentialArea: faker.address.county() + generateRandomSuffix(), - street: faker.address.streetName(), - number: faker.address.buildingNumber(), - postcodeOrZip: faker.address.zipCode() + town: faker.location.city(), + residentialArea: faker.location.county() + generateRandomSuffix(), + street: faker.location.street(), + number: faker.location.buildingNumber(), + postcodeOrZip: faker.location.zipCode() } }, event: { @@ -70,13 +71,13 @@ const declaration = { informantEmail: faker.internet.email(), spouse: { name: { - firstNames: faker.name.firstName('female'), - familyName: faker.name.lastName('female') + firstNames: faker.person.firstName('female'), + familyName: faker.person.lastName('female') }, birthDate: getRandomDate(50, 200, 200), nationality: 'Farajaland', identifier: { - id: faker.random.numeric(10), + id: faker.string.numeric(10), type: 'NATIONAL_ID' }, address: { diff --git a/package.json b/package.json index e9ed98521..6cbdf3c4f 100644 --- a/package.json +++ b/package.json @@ -45,13 +45,13 @@ "@playwright/test": "^1.48.0", "@types/google-libphonenumber": "^7.4.23", "@types/handlebars": "^4.1.0", + "@types/hapi__h2o2": "8.3.3", "@types/hapi__inert": "5.2.1", "@types/inquirer": "^9.0.7", "@types/libsodium-wrappers": "^0.7.10", "@types/minimist": "^1.2.5", "@types/prompts": "^2.4.9", "@types/react-intl": "^3.0.0", - "@types/hapi__h2o2": "8.3.3", "@typescript-eslint/eslint-plugin": "^5.60.1", "@typescript-eslint/parser": "^5.60.1", "eslint": "^8.43.0", @@ -71,7 +71,7 @@ "vitest": "^2.1.2" }, "dependencies": { - "@faker-js/faker": "^7.6.0", + "@faker-js/faker": "^9.3.0", "@hapi/boom": "^9.1.1", "@hapi/h2o2": "^9.1.0", "@hapi/hapi": "^20.0.1", @@ -90,6 +90,7 @@ "@types/node": "^10.12.5", "@types/node-fetch": "^2.6.2", "@types/nodemailer": "^6.4.14", + "@types/uuid": "^10.0.0", "app-module-path": "^2.2.0", "chalk": "^2.4.1", "country-data": "^0.0.31", diff --git a/src/data-generator/address.ts b/src/data-generator/address.ts index c5225e910..981d916f9 100644 --- a/src/data-generator/address.ts +++ b/src/data-generator/address.ts @@ -6,12 +6,12 @@ export function createAddressInput(location: Location, type: string) { country: 'FAR', state: location.partOf.split('/')[1], district: location.id, - city: faker.address.city(), - postalCode: faker.address.zipCode(), + city: faker.location.city(), + postalCode: faker.location.zipCode(), type, line: [ - faker.address.streetAddress(), - faker.address.zipCode(), + faker.location.streetAddress(), + faker.location.zipCode(), 'URBAN', '', '', diff --git a/src/data-generator/declare.ts b/src/data-generator/declare.ts index 2565d342e..92670b8bf 100644 --- a/src/data-generator/declare.ts +++ b/src/data-generator/declare.ts @@ -76,9 +76,9 @@ export async function sendBirthNotification( district: Location, office: Facility ): Promise { - const lastName = faker.name.lastName() - const firstName = faker.name.firstName() - const motherFirstName = faker.name.firstName('female') + const lastName = faker.person.lastName() + const firstName = faker.person.firstName() + const motherFirstName = faker.person.firstName('female') const requestStart = Date.now() const notification = birthNotification({ @@ -89,36 +89,35 @@ export async function sendBirthNotification( gender: sex }, father: { - firstName: faker.name.firstName('male'), + firstName: faker.person.firstName('male'), lastName, - nid: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) - .toString(), + nid: faker.number.bigInt({ min: 1000000000, max: 9999999999 }).toString(), dateOfBirth: sub(birthDate, { years: 20 }).toISOString().split('T')[0] }, mother: { firstName: motherFirstName, lastName, dateOfBirth: sub(birthDate, { years: 20 }).toISOString().split('T')[0], - nid: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) - .toString() + nid: faker.number.bigInt({ min: 1000000000, max: 9999999999 }).toString() }, createdAt: createdAt.toISOString(), address: [ { type: 'PRIMARY_ADDRESS', line: ['12', 'Usual Street', 'Usual Residental Area', '', '', 'URBAN'], - city: faker.address.city(), + city: faker.location.city(), district: district.id, state: district.partOf.split('/')[1], - postalCode: faker.address.zipCode(), + postalCode: faker.location.zipCode(), country: 'FAR' } ], phoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - email: faker.internet.email(motherFirstName, lastName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + email: faker.internet.email({ + firstName: motherFirstName, + lastName: lastName + }), dateOfBirth: birthDate.toISOString().split('T')[0], placeOfBirth: `Location/${facility.id}`, officeLocation: office.partOf, @@ -169,9 +168,9 @@ export function createBirthDeclarationData( base64Attachment: string ): BirthRegistrationInput { const timeFilling = Math.round(100000 + Math.random() * 100000) // 100 - 200 seconds - const familyName = faker.name.lastName() - const firstNames = faker.name.firstName() - const motherFirstName = faker.name.firstName('female') + const familyName = faker.person.lastName() + const firstNames = faker.person.firstName() + const motherFirstName = faker.person.firstName('female') const isLateRegistration = differenceInDays(new Date(), birthDate) > 365 const mother: PersonInput = { @@ -181,8 +180,8 @@ export function createBirthDeclarationData( dateOfMarriage: sub(birthDate, { years: 2 }).toISOString().split('T')[0], identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId } @@ -208,8 +207,11 @@ export function createBirthDeclarationData( informantType: informant.mother, otherInformantType: '', contactPhoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - contactEmail: faker.internet.email(motherFirstName, familyName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + email: faker.internet.email({ + firstName: motherFirstName, + lastName: familyName + }), status: [ { timestamp: sub(declarationTime, { @@ -218,7 +220,7 @@ export function createBirthDeclarationData( timeLoggedMS: timeFilling * 1000 } ], - draftId: faker.datatype.uuid(), + draftId: faker.string.uuid(), attachments: faker.helpers .arrayElements(BIRTH_ATTACHMENTS, NUMBER_OF_ATTACHMENTS_PER_RECORD) .map((attachment) => ({ @@ -268,11 +270,11 @@ export function createBirthDeclarationData( country: 'FAR', state: location.partOf.replace('Location/', ''), district: location.id, - city: faker.address.city(), - postalCode: faker.address.zipCode(), + city: faker.location.city(), + postalCode: faker.location.zipCode(), line: [ - faker.address.streetAddress(), - faker.address.zipCode(), + faker.location.streetAddress(), + faker.location.zipCode(), 'URBAN' ] }, @@ -357,9 +359,9 @@ export async function createDeathDeclaration( facility: Facility, base64Attachment: string ) { - const familyName = faker.name.lastName() - const firstNames = faker.name.firstName() - const spouseFirstName = faker.name.firstName() + const familyName = faker.person.lastName() + const firstNames = faker.person.firstName() + const spouseFirstName = faker.person.firstName() const requestStart = Date.now() @@ -374,8 +376,11 @@ export async function createDeathDeclaration( registration: { informantType: 'SPOUSE', contactPhoneNumber: - '+2607' + faker.datatype.number({ min: 10000000, max: 99999999 }), - contactEmail: faker.internet.email(spouseFirstName, familyName), + '+2607' + faker.number.bigInt({ min: 10000000, max: 99999999 }), + contactEmail: faker.internet.email({ + firstName: spouseFirstName, + lastName: familyName + }), attachments: faker.helpers .arrayElements(DEATH_ATTACHMENTS, NUMBER_OF_ATTACHMENTS_PER_RECORD) .map((attachment) => ({ @@ -383,7 +388,7 @@ export async function createDeathDeclaration( contentType: 'image/png', data: 'data:image/png;base64,' + base64Attachment })), - draftId: faker.datatype.uuid(), + draftId: faker.string.uuid(), status: [ { timestamp: sub(declarationTime, { @@ -398,14 +403,14 @@ export async function createDeathDeclaration( deceased: { identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId }, { - id: faker.datatype - .number({ min: 100000000, max: 999999999 }) + id: faker.number + .bigInt({ min: 100000000, max: 999999999 }) .toString(), type: identity.socialSecurityNumber } @@ -454,8 +459,8 @@ export async function createDeathDeclaration( nationality: ['FAR'], identifier: [ { - id: faker.datatype - .number({ min: 1000000000, max: 9999999999 }) + id: faker.number + .bigInt({ min: 1000000000, max: 9999999999 }) .toString(), type: identity.nationalId } diff --git a/src/data-generator/users.ts b/src/data-generator/users.ts index 59c7b093f..84304794b 100644 --- a/src/data-generator/users.ts +++ b/src/data-generator/users.ts @@ -81,8 +81,8 @@ export async function createUser( phoneNumberRegex: string, overrides: Record ) { - const firstName = faker.name.firstName() - const familyName = faker.name.lastName() + const firstName = faker.person.firstName() + const familyName = faker.person.lastName() log('Creating user', firstName, familyName, overrides) const phoneNumberExpander = expand(phoneNumberRegex) @@ -100,15 +100,15 @@ export async function createUser( identifier: [ { system: 'NATIONAL_ID', - value: faker.datatype - .number({ min: 100000000, max: 999999999 }) + value: faker.number + .bigInt({ min: 100000000, max: 999999999 }) .toString() } ], username: firstName.toLocaleLowerCase() + '.' + familyName.toLocaleLowerCase(), mobile: convertToMSISDN(generatedPhoneNumber, countryAlpha3), - email: faker.internet.email(undefined, undefined, 'example.com'), + email: faker.internet.email({ provider: 'example.com' }), primaryOffice: primaryOfficeId, ...overrides } diff --git a/tsconfig.json b/tsconfig.json index 955714f93..beba0ad94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "sourceMap": true, "moduleResolution": "node16", "rootDir": ".", - "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022"], + "lib": ["esnext.asynciterable", "es6", "es2017", "es2019", "es2022", "dom"], "forceConsistentCasingInFileNames": true, "esModuleInterop": true, "noImplicitReturns": true, @@ -18,9 +18,15 @@ "noImplicitAny": true, "skipLibCheck": true, "strictNullChecks": true, - "types": ["jest", "fhir", "geojson"] + "types": ["jest", "fhir", "geojson"], + "resolveJsonModule": true }, - "include": ["src/**/*.ts", "infrastructure/environments/**/*.ts", "typings"], + "include": [ + "src/**/*.ts", + "infrastructure/environments/**/*.ts", + "typings", + "e2e/**/*.ts" + ], "exclude": [ "node_modules", "build", diff --git a/yarn.lock b/yarn.lock index 39488e3e8..816461e95 100644 --- a/yarn.lock +++ b/yarn.lock @@ -732,10 +732,10 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f" integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g== -"@faker-js/faker@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07" - integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw== +"@faker-js/faker@^9.3.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-9.3.0.tgz#ef398dab34c67faaa0e348318c905eae3564fa58" + integrity sha512-r0tJ3ZOkMd9xsu3VRfqlFR6cz0V/jFYRswAIpC+m/DIfAUXq7g8N7wTAlhSANySXYGKzGryfDXwtwsY8TxEIDw== "@formatjs/ecma402-abstract@2.2.3": version "2.2.3" @@ -2324,6 +2324,11 @@ dependencies: "@types/node" "*" +"@types/uuid@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-10.0.0.tgz#e9c07fe50da0f53dc24970cca94d619ff03f6f6d" + integrity sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ== + "@types/wrap-ansi@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz#18b97a972f94f60a679fd5c796d96421b9abb9fd" From 54b74103e4135290652c4ef9da4a6af3883f5032 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Fri, 20 Dec 2024 17:01:15 +0600 Subject: [PATCH 29/32] path added in filebeat --- infrastructure/monitoring/filebeat/filebeat.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/infrastructure/monitoring/filebeat/filebeat.yml b/infrastructure/monitoring/filebeat/filebeat.yml index 8f75ec4b9..9ffef5a6f 100644 --- a/infrastructure/monitoring/filebeat/filebeat.yml +++ b/infrastructure/monitoring/filebeat/filebeat.yml @@ -11,6 +11,10 @@ filebeat.inputs: enabled: true paths: - /var/log/opencrvs-backup.log + - type: log + enabled: true + paths: + - /var/log/opencrvs-backup.error.log - type: log enabled: true paths: From a7bb2f43516acaf0b314a2a41eb68f202bfd5041 Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Fri, 20 Dec 2024 17:15:00 +0600 Subject: [PATCH 30/32] make sure backup error file exists --- infrastructure/server-setup/tasks/application.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/infrastructure/server-setup/tasks/application.yml b/infrastructure/server-setup/tasks/application.yml index 4d70e66b4..a1a441de3 100644 --- a/infrastructure/server-setup/tasks/application.yml +++ b/infrastructure/server-setup/tasks/application.yml @@ -49,6 +49,14 @@ state: touch mode: 'u+rwX,g+rwX,o-rwx' +- name: Create backup logfile for error + ansible.builtin.file: + path: /var/log/opencrvs-backup.error.log + owner: '{{ ansible_user }}' + group: 'application' + state: touch + mode: 'u+rwX,g+rwX,o-rwx' + - name: Create restore logfile ansible.builtin.file: path: /var/log/opencrvs-restore.log From 8217feb5a3d6da19595ba4c29a83a7e320cfe53c Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Fri, 20 Dec 2024 17:29:51 +0600 Subject: [PATCH 31/32] modify the crontab command --- infrastructure/server-setup/tasks/backups/crontab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infrastructure/server-setup/tasks/backups/crontab.yml b/infrastructure/server-setup/tasks/backups/crontab.yml index 8abd21d67..52228dee6 100644 --- a/infrastructure/server-setup/tasks/backups/crontab.yml +++ b/infrastructure/server-setup/tasks/backups/crontab.yml @@ -20,7 +20,7 @@ name: 'backup opencrvs' minute: '0' hour: '0' - job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2>&1' + job: 'bash {{ crontab_user_home }}/backup.sh --passphrase={{ backup_encryption_passphrase }} --ssh_user={{ backup_server_user }} --ssh_host={{ backup_hostname }} --ssh_port={{ backup_port }} --remote_dir={{ backup_server_remote_target_directory }} --replicas=1 >> /var/log/opencrvs-backup.log 2>> /var/log/opencrvs-backup.error.log' state: "{{ 'present' if (backup_hostname is defined and backup_encryption_passphrase and (enable_backups | default(false))) else 'absent' }}" ## From 77fa39a6420f62807620dec6e9ab0a31d3e9b73b Mon Sep 17 00:00:00 2001 From: "Al hel md. shahriar zaman" Date: Fri, 20 Dec 2024 18:05:00 +0600 Subject: [PATCH 32/32] logrotate modified for backup error file --- infrastructure/logrotate.conf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infrastructure/logrotate.conf b/infrastructure/logrotate.conf index 60fe35055..8b965ffe7 100644 --- a/infrastructure/logrotate.conf +++ b/infrastructure/logrotate.conf @@ -72,6 +72,13 @@ include /etc/logrotate.d rotate 1 } +/var/log/opencrvs-backup.error.log { + missingok + monthly + create 0660 root application + rotate 1 +} + /var/log/papertrail.log { missingok monthly