diff --git a/package-lock.json b/package-lock.json index 8a5552f..de3a788 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.2", "handlebars": "^4.7.8", + "jwt-decode": "^4.0.0", "node-cache": "^5.1.2", "pg": "^8.16.3", "reflect-metadata": "^0.1.13", @@ -9051,6 +9052,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jwt-decode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jwt-decode/-/jwt-decode-4.0.0.tgz", + "integrity": "sha512-+KJGIyHgkGuIq3IEBNftfhW/LfWhXUIY6OmyVWjliu5KH1y0fw7VQ8YndE2O4qZdMSd9SqbnC8GOcZEy0Om7sA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", diff --git a/package.json b/package.json index b152295..96692ec 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "class-validator": "^0.14.2", "handlebars": "^4.7.8", "node-cache": "^5.1.2", + "jwt-decode": "^4.0.0", "pg": "^8.16.3", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", diff --git a/schemas/register-birth-form.json b/schemas/register-birth-form.json index ed7e245..78986ff 100644 --- a/schemas/register-birth-form.json +++ b/schemas/register-birth-form.json @@ -24,7 +24,18 @@ { "name": "father", "type": "object", - "required": false, + "required": { + "when": { + "all": [ + { + "field": "includeFatherDetails", + "operator": "equals", + "value": "yes" + } + ] + }, + "message": "Father details are required when includeFatherDetails is yes" + }, "fields": [ { "name": "firstName", @@ -52,6 +63,27 @@ "max": 100 } }, + { + "name": "age", + "type": "string", + "required": { + "when": { + "all": [{ "field": "father.idNumber", "operator": "empty" }] + }, + "message": "Age is required when no ID number is provided" + }, + "validations": { + "condition": { + "field": "father.age", + "operator": "notIn", + "value": [null, ""], + "then": { + "regex": "^(1[2-9]|[2-9][0-9]|1[0-1][0-9]|120)$", + "message": "Age should be between 12 and 120" + } + } + } + }, { "name": "parish", "type": "string", @@ -90,9 +122,23 @@ { "name": "passportNumber", "type": "string", - "required": false, + "required": { + "when": { + "all": [{ "field": "father.idNumber", "operator": "empty" }] + }, + "message": "Passport number is required when no ID number is provided" + }, "validations": { - "max": 50 + "condition": { + "field": "father.passportNumber", + "operator": "notIn", + "value": [null, ""], + "then": { + "min": 6, + "max": 50, + "message": "Passport number must be between 6 and 50 characters" + } + } } }, { @@ -120,17 +166,79 @@ "message": "Must select an option" } }, + { + "name": "healthFacility", + "type": "string", + "label": "Health Facility", + "required": { + "when": { + "all": [ + { + "field": "birth.placeOfBirth", + "operator": "equals", + "value": "health-facility" + } + ] + }, + "message": "Health facility is required when place of birth is health-facility" + } + }, { "name": "parish", "type": "string", "label": "Parish", - "required": false + "required": { + "when": { + "all": [ + { + "field": "birth.placeOfBirth", + "operator": "in", + "value": ["residential", "other"] + } + ] + }, + "message": "Parish is required for residential/other birth locations" + }, + "validations": { + "condition": { + "field": "birth.parish", + "operator": "notIn", + "value": [null, ""], + "then": { + "regex": "^(christ-church|st-andrew|st-george|st-james|st-john|st-joseph|st-lucy|st-michael|st-peter|st-philip|st-thomas)$", + "message": "Must select a valid parish" + } + } + } }, { "name": "streetAddress", "type": "string", "label": "Street Address", - "required": false + "required": { + "when": { + "all": [ + { + "field": "birth.placeOfBirth", + "operator": "in", + "value": ["residential", "other"] + } + ] + }, + "message": "Street address is required for residential/other birth locations" + }, + "validations": { + "condition": { + "field": "birth.streetAddress", + "operator": "notIn", + "value": [null, ""], + "then": { + "min": 5, + "max": 200, + "message": "Address must be at least 5 characters" + } + } + } }, { "name": "numberOfBirths", @@ -203,6 +311,27 @@ "max": 100 } }, + { + "name": "age", + "type": "string", + "required": { + "when": { + "all": [{ "field": "mother.idNumber", "operator": "empty" }] + }, + "message": "Age is required when no ID number is provided" + }, + "validations": { + "condition": { + "field": "mother.age", + "operator": "notIn", + "value": [null, ""], + "then": { + "regex": "^(1[2-9]|[2-9][0-9]|1[0-1][0-9]|120)$", + "message": "Age should be between 12 and 120" + } + } + } + }, { "name": "maidenSurname", "type": "string", @@ -249,9 +378,23 @@ { "name": "passportNumber", "type": "string", - "required": false, + "required": { + "when": { + "all": [{ "field": "mother.idNumber", "operator": "empty" }] + }, + "message": "Passport number is required when no ID number is provided" + }, "validations": { - "max": 50 + "condition": { + "field": "mother.passportNumber", + "operator": "notIn", + "value": [null, ""], + "then": { + "min": 6, + "max": 50, + "message": "Passport number must be between 6 and 50 characters" + } + } } }, { diff --git a/schemas/sell-goods-services-beach-park.json b/schemas/sell-goods-services-beach-park.json index 95f52e2..8ae9b23 100644 --- a/schemas/sell-goods-services-beach-park.json +++ b/schemas/sell-goods-services-beach-park.json @@ -430,6 +430,166 @@ } ] }, + { + "name": "firstTestimonial", + "type": "object", + "required": true, + "fields": [ + { + "name": "firstName", + "type": "string", + "label": "First name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "First name must be at least 2 characters" + } + }, + { + "name": "lastName", + "type": "string", + "label": "Last name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "Last name must be at least 2 characters" + } + }, + { + "name": "relationship", + "type": "string", + "label": "Relationship", + "required": true, + "validations": { + "regex": "^(community-leader|mentor|religious-leader|teacher|coach|neighbour|other)$", + "message": "Must select a valid relationship" + } + }, + { + "name": "addressLine1", + "type": "string", + "label": "Address line 1", + "required": true, + "validations": { + "min": 5, + "max": 200, + "message": "Address must be at least 5 characters" + } + }, + { + "name": "addressLine2", + "type": "string", + "label": "Address line 2", + "required": false, + "validations": { + "max": 200 + } + }, + { + "name": "parish", + "type": "string", + "label": "Parish", + "required": true, + "validations": { + "regex": "^(christ-church|st-andrew|st-george|st-james|st-john|st-joseph|st-lucy|st-michael|st-peter|st-philip|st-thomas)$", + "message": "Must select a valid parish" + } + }, + { + "name": "testimonial", + "type": "string", + "label": "Testimonial", + "required": true, + "validations": { + "min": 10, + "max": 1000, + "message": "Testimonial must be at least 10 characters" + } + } + ] + }, + { + "name": "secondTestimonial", + "type": "object", + "required": true, + "fields": [ + { + "name": "firstName", + "type": "string", + "label": "First name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "First name must be at least 2 characters" + } + }, + { + "name": "lastName", + "type": "string", + "label": "Last name", + "required": true, + "validations": { + "min": 2, + "max": 100, + "message": "Last name must be at least 2 characters" + } + }, + { + "name": "relationship", + "type": "string", + "label": "Relationship", + "required": true, + "validations": { + "regex": "^(community-leader|mentor|religious-leader|teacher|coach|neighbour|other)$", + "message": "Must select a valid relationship" + } + }, + { + "name": "addressLine1", + "type": "string", + "label": "Address line 1", + "required": true, + "validations": { + "min": 5, + "max": 200, + "message": "Address must be at least 5 characters" + } + }, + { + "name": "addressLine2", + "type": "string", + "label": "Address line 2", + "required": false, + "validations": { + "max": 200 + } + }, + { + "name": "parish", + "type": "string", + "label": "Parish", + "required": true, + "validations": { + "regex": "^(christ-church|st-andrew|st-george|st-james|st-john|st-joseph|st-lucy|st-michael|st-peter|st-philip|st-thomas)$", + "message": "Must select a valid parish" + } + }, + { + "name": "testimonial", + "type": "string", + "label": "Testimonial", + "required": true, + "validations": { + "min": 10, + "max": 1000, + "message": "Testimonial must be at least 10 characters" + } + } + ] + }, { "name": "documents", "type": "object", diff --git a/src/config/configuration.ts b/src/config/configuration.ts index 9991e80..92eed15 100644 --- a/src/config/configuration.ts +++ b/src/config/configuration.ts @@ -58,9 +58,6 @@ export default () => ({ }, }, opencrvs: { - // Use localhost URLs when running locally against OpenCRVS dev environment - localhost: process.env.OPENCRVS_LOCALHOST === 'true', - // Production/QA URLs authBaseUrl: process.env.OPENCRVS_AUTH_URL || 'https://auth.barbados-qa.opencrvs.org', eventsBaseUrl: diff --git a/src/email/templates/post-office-redirection-individual-receipt.hbs b/src/email/templates/post-office-redirection-individual-receipt.hbs index 6a4f008..ca54666 100644 --- a/src/email/templates/post-office-redirection-individual-receipt.hbs +++ b/src/email/templates/post-office-redirection-individual-receipt.hbs @@ -1,7 +1,7 @@ -
- - - - -Your Submission ID: {{submissionId}}
-Please save this ID for your records.
-Your request to redirect your personal mail has been received. The Barbados Postal Service will process your request and begin redirecting mail to your new address within the specified timeframe. You will receive confirmation once the redirection is active.
-If you have questions about your mail redirection, please contact the Barbados Postal Service.
-+ Reference number: {{ submissionId }} +
++ Everyone who is 18 years old and over who wants to redirect their personal mail must visit any Post Office, in person, to: +
+The Post Office cashier will ask for the reference number above.
+