From e67f4d6ab957941d1eedd146a3679557ba46035c Mon Sep 17 00:00:00 2001 From: Anamul Haque Date: Thu, 13 Jun 2024 17:42:59 +0600 Subject: [PATCH] fix: nid validation to prevent the informant, father, and mother from having the same id (#1011) * changed parametes like mother.id to motherNationalId * updated changelog.md * updated changelog.md --- CHANGELOG.md | 1 + .../common/default-validation-conditionals.ts | 20 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c94cd6b7f..8e43e6294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - Each environment now has a dedicated docker-compose--deploy.yml. Use `environment:init` to create a new environment and generate a corresponding file for customizable configurations. - 🔒 OpenHIM console is no longer exposed via HTTP. - Ansible playbooks are refactored into smaller task files. +- Resolved the issue of National ID validation to prevent the informant, father, and mother from having the same ID. ### New features diff --git a/src/form/common/default-validation-conditionals.ts b/src/form/common/default-validation-conditionals.ts index e3f3ed41d..0cd063d3a 100644 --- a/src/form/common/default-validation-conditionals.ts +++ b/src/form/common/default-validation-conditionals.ts @@ -317,7 +317,7 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['mother.iD'] + parameters: ['mother.motherNationalId'] } ] } else if (configCase === 'mother') { @@ -328,7 +328,7 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['father.iD'] + parameters: ['father.fatherNationalId'] } ] } else if (configCase === 'deceased') { @@ -339,7 +339,7 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['informant.informantID'] + parameters: ['informant.informantNationalId'] } ] } else if (configCase === 'groom') { @@ -350,7 +350,7 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['bride.iD'] + parameters: ['bride.brideNationalId'] } ] } else if (configCase === 'bride') { @@ -361,7 +361,7 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['groom.iD'] + parameters: ['groom.groomNationalId'] } ] } else { @@ -373,23 +373,23 @@ export function getNationalIDValidators(configCase: string): Validator[] { }, { operation: 'duplicateIDNumber', - parameters: ['deceased.deceasedID'] + parameters: ['deceased.deceasedNationalId'] }, { operation: 'duplicateIDNumber', - parameters: ['mother.iD'] + parameters: ['mother.motherNationalId'] }, { operation: 'duplicateIDNumber', - parameters: ['father.iD'] + parameters: ['father.fatherNationalId'] }, { operation: 'duplicateIDNumber', - parameters: ['groom.iD'] + parameters: ['groom.groomNationalId'] }, { operation: 'duplicateIDNumber', - parameters: ['bride.iD'] + parameters: ['bride.brideNationalId'] } ] }