Skip to content
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
157 changes: 150 additions & 7 deletions schemas/register-birth-form.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
}
},
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
}
},
{
Expand Down
Loading