From 86fa113f7a3bcb85ebc036bd223870bdfe0d1e42 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Thu, 8 Jan 2026 18:03:30 -0400 Subject: [PATCH 01/18] Added schema for temporary teacher application --- schemas/temporary-teacher-application.json | 643 +++++++++++++++++++++ 1 file changed, 643 insertions(+) create mode 100644 schemas/temporary-teacher-application.json diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json new file mode 100644 index 0000000..533269b --- /dev/null +++ b/schemas/temporary-teacher-application.json @@ -0,0 +1,643 @@ +{ + "id": "temporary-teacher-application", + "name": "Temporary Teacher Application", + "description": "Apply to be a temporary teacher", + "fields": [ + { + "name": "applicant", + "type": "object", + "required": true, + "fields": [ + { + "name": "firstName", + "type": "string", + "label": "First Name", + "required": true, + "validations": { + "min": 2, + "max": 50 + } + }, + { + "name": "middleName", + "type": "string", + "label": "Middle name(s)", + "required": false, + "validations": { + "min": 2, + "max": 50 + } + }, + { + "name": "lastName", + "type": "string", + "label": "Last Name", + "required": true, + "validations": { + "min": 2, + "max": 50 + } + }, + { + "name": "dateOfBirth", + "type": "date", + "label": "Date of Birth", + "required": true, + "validations": { + "regex": "^\\d{4}-\\d{2}-\\d{2}$", + "message": "Date must be in YYYY-MM-DD format" + } + }, + { + "name": "placeOfBirth", + "type": "string", + "label": "Place of birth", + "required": true + }, + { + "name": "nationality", + "type": "array", + "label": "Nationality", + "required": true, + "items": { + "type": "object", + "properties": { + "value": { + "type": "string" + } + } + } + }, + { + "name": "sex", + "type": "select", + "label": "Sex", + "required": true, + "options": [ + { + "label": "Male", + "value": "male" + }, + { + "label": "Female", + "value": "female" + } + ], + "validations": { + "regex": "^(male|female)$", + "message": "Must select a valid sex" + } + }, + { + "name": "martialStatus", + "type": "select", + "label": "Martial status", + "required": true, + "options": [ + { + "label": "Single", + "value": "single" + }, + { + "label": "Married", + "value": "married" + }, + { + "label": "Divorced", + "value": "divorced" + } + ], + "validations": { + "regex": "^(male|female)$", + "message": "Must select a valid sex" + } + }, + { + "name": "nationalIdNumber", + "type": "string", + "label": "National Identification (ID) number", + "required": false, + "validations": { + "regex": "^[0-9]{6}-[0-9]{4}$", + "message": "Invalid ID number." + } + }, + { + "name": "passportNumber", + "type": "string", + "label": "Passport Number (#)", + "required": false + }, + { + "name": "nationalInsuranceNumber", + "type": "string", + "label": "National Insurance number (NIS)", + "required": false + } + ] + }, + { + "name": "barbadosResidencyDuration", + "label": "How long have you lived in Barbados?", + "type": "string", + "required": true, + "validations": { + "min": 2, + "max": 20 + } + }, + { + "name": "contactDetails", + "type": "object", + "required": true, + "fields": [ + { + "name": "addressLine1", + "type": "string", + "label": "Address Line 1", + "required": true + }, + { + "name": "addressLine2", + "type": "string", + "label": "Address Line 2", + "required": false + }, + { + "name": "country", + "type": "select", + "label": "Country", + "required": true, + "options": [ + { + "label": "Barbados", + "value": "barbados" + } + ] + }, + { + "name": "parish", + "type": "select", + "label": "Parish", + "required": true, + "options": [ + { + "value": "christ-church", + "label": "Christ Church" + }, + { + "value": "st-andrew", + "label": "St Andrew" + }, + { + "value": "st-george", + "label": "St George" + }, + { + "value": "st-james", + "label": "St James" + }, + { + "value": "st-john", + "label": "St John" + }, + { + "value": "st-joseph", + "label": "St Joseph" + }, + { + "value": "st-lucy", + "label": "St Lucy" + }, + { + "value": "st-michael", + "label": "St Michael" + }, + { + "value": "st-peter", + "label": "St Peter" + }, + { + "value": "st-philip", + "label": "St Philip" + }, + { + "value": "st-thomas", + "label": "St Question, so for boolean Thomas" + } + ] + }, + { + "name": "postcode", + "type": "string", + "label": "Postcode", + "required": false + }, + { + "name": "emailAddress", + "type": "email", + "label": "Email address", + "required": true + }, + { + "name": "telephoneNumber", + "type": "string", + "label": "Telephone Number", + "required": true, + "validations": { + "regex": "^\\+?[0-9]{10,15}$", + "message": "Telephone number must be 10-15 digits" + } + } + ] + }, + { + "name": "applicant-education", + "type": "object", + "required": true, + "fields": [ + { + "name": "nameOfInstitution", + "type": "string", + "label": "Name of Institution", + "required": true + }, + { + "name": "country", + "type": "string", + "label": "Country", + "required": false + }, + { + "name": "startYear", + "label": "Start Year", + "type": "number", + "required": true, + "validations": { + "min": 1950 + } + }, + { + "name": "endYear", + "label": "End Year", + "type": "number", + "required": true, + "validations": { + "min": 1950 + } + }, + { + "name": "anotherEducation", + "label": "Do you want to add another education experience?", + "type": "boolean", + "required": true, + "options": [ + { + "label": "Yes", + "value": "yes" + }, + { + "label": "No", + "value": "no" + } + ] + } + ] + }, + { + "name": "applicantQualification", + "type": "object", + "required": true, + "fields": [ + { + "name": "subject", + "label": "Subject", + "type": "string", + "required": true + }, + { + "name": "examiningBody", + "label": "Examining Body", + "type": "string", + "required": true + }, + { + "name": "year", + "label": "Year", + "type": "number", + "required": true, + "validations": { + "min": 1950 + } + }, + { + "name": "levelGrade", + "label": "Level / Grade Obtained", + "type": "string", + "required": true + }, + { + "name": "anotherQualification", + "label": "Do you want to add another qualification", + "type": "boolean", + "required": true, + "options": [ + "Yes", + "No" + ] + } + ] + }, + { + "name": "applicantWorkExperience", + "required": true, + "type": "object", + "fields": [ + { + "name": "employerName", + "label": "Name of employer or organization", + "type": "string", + "required": true + }, + { + "name": "positionHeld", + "label": "Position held", + "type": "string", + "required": true + }, + { + "name": "fromYear", + "label": "From (year)", + "type": "number", + "required": true, + "validations": { + "min": 1950 + } + }, + { + "name": "toYear", + "label": "To (year)", + "type": "number", + "required": false, + "validations": { + "min": 1950 + } + }, + { + "name": "currentlyWorking", + "label": "I am currently working here", + "type": "boolean", + "required": false + }, + { + "name": "tasks", + "label": "Your main tasks", + "required": true, + "type": "string" + }, + { + "name": "anotherExperience", + "required": true, + "type": "boolean", + "label": "Do you want to add another experience?", + "options": [ + "Yes", + "No" + ] + } + ] + }, + { + "name": "skillsAndExperience", + "type": "object", + "required": true, + "fields": [ + { + "name": "athleticsGamesCraftSkills", + "label": "Athletics, games, or craft skills", + "type": "string", + "required": false + }, + { + "name": "youthCommunityVolunteerGroups", + "label": "Experience in youth, community, or volunteer groups", + "type": "string", + "required": false + }, + { + "name": "responsibilityPositions", + "label": "Positions of responsibility held", + "type": "string", + "required": false + }, + { + "name": "extraDetails", + "label": "Anything else relevant to your application?", + "type": "string", + "required": false + } + ] + }, + { + "name": "reference", + "required": true, + "type": "object", + "fields": [ + { + "name": "title", + "label": "Title", + "required": true, + "type": "select", + "options": [ + { + "label": "Mr", + "value": "mr" + }, + { + "label": "Mrs", + "value": "mrs" + }, + { + "label": "Miss", + "value": "miss" + } + ] + }, + { + "name": "firstName", + "type": "string", + "label": "First Name", + "required": true, + "validations": { + "min": 2, + "max": 50 + } + }, + { + "name": "lastName", + "type": "string", + "label": "Last Name", + "required": true, + "validations": { + "min": 2, + "max": 50 + } + }, + { + "name": "addressLine1", + "type": "string", + "label": "Address Line 1", + "required": true + }, + { + "name": "addressLine2", + "type": "string", + "label": "Address Line 2", + "required": false + }, + { + "name": "country", + "type": "select", + "label": "Country", + "required": true, + "options": [ + { + "label": "Barbados", + "value": "barbados" + } + ] + }, + { + "name": "parish", + "type": "select", + "label": "Parish", + "required": true, + "options": [ + { + "value": "christ-church", + "label": "Christ Church" + }, + { + "value": "st-andrew", + "label": "St Andrew" + }, + { + "value": "st-george", + "label": "St George" + }, + { + "value": "st-james", + "label": "St James" + }, + { + "value": "st-john", + "label": "St John" + }, + { + "value": "st-joseph", + "label": "St Joseph" + }, + { + "value": "st-lucy", + "label": "St Lucy" + }, + { + "value": "st-michael", + "label": "St Michael" + }, + { + "value": "st-peter", + "label": "St Peter" + }, + { + "value": "st-philip", + "label": "St Philip" + }, + { + "value": "st-thomas", + "label": "St Question, so for boolean Thomas" + } + ] + }, + { + "name": "postcode", + "type": "string", + "label": "Postcode", + "required": false + }, + { + "name": "occupation", + "label": "Occupation", + "required": true, + "type": "string" + }, + { + "name": "emailAddress", + "type": "email", + "label": "Email address", + "required": true + }, + { + "name": "telephoneNumber", + "type": "string", + "label": "Telephone Number", + "required": true, + "validations": { + "regex": "^\\+?[0-9]{10,15}$", + "message": "Telephone number must be 10-15 digits" + } + }, + { + "name": "anotherReference", + "required": true, + "type": "boolean", + "label": "Do you want to add another reference?", + "options": [ + "Yes", + "No" + ] + } + ] + }, + { + "name": "documents", + "type": "object", + "required": true, + "fields": [ + { + "name": "certificateDiplomaTranscript", + "label": "Upload your certificates, diplomas, and transcripts", + "required": true, + "type": "object" + }, + { + "name": "testimonials", + "label": "Upload your two testimonials", + "required": true, + "type": "array", + "items": { + "type": "object", + "properties": { + "file1": { + "type": "file" + }, + "file2": { + "type": "file" + } + } + } + } + ] + } + ], + "processors": [ + { + "type": "email", + "config": { + "to": "{{db:temporary-teacher-application:admin_email}}", + "subject": "New Temporary Teacher Application - {{formData.firstName}} {{formData.lastName}}", + "template": "temporary-teacher-application" + } + } + ] +} From 5e998056a4c07ba3b321e4c13c6fc796aa7622dc Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 12 Jan 2026 09:16:33 -0400 Subject: [PATCH 02/18] Updated incorrect error for martial status --- schemas/temporary-teacher-application.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index 533269b..ee47eac 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -108,8 +108,8 @@ } ], "validations": { - "regex": "^(male|female)$", - "message": "Must select a valid sex" + "regex": "^(single|married|divorced)$", + "message": "Must select a martial status" } }, { From 36ee68097c5291309c26971bee6edddea3193cc9 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 12 Jan 2026 10:51:39 -0400 Subject: [PATCH 03/18] Created an email template for Apply to be a temp teacher --- .../temporary-teacher-application.hbs | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/email/templates/temporary-teacher-application.hbs diff --git a/src/email/templates/temporary-teacher-application.hbs b/src/email/templates/temporary-teacher-application.hbs new file mode 100644 index 0000000..41271b0 --- /dev/null +++ b/src/email/templates/temporary-teacher-application.hbs @@ -0,0 +1,122 @@ + + + + + + +
+

Application Submitted: Temporary Teacher

+
+
+
+

+ Dear applicant, +
+ Your application to be a temporary teacher has been submitted. +
+ Your application reference number is {{ referenceNumber }}. +

+

+ We will review your application. +
+ If we need more information or supporting documents, we will contact you using the details you provided. +

+
+
+ + + From dcd80be60d490cff54f0e657e4772ecaaadde1ba Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 12 Jan 2026 18:40:51 -0400 Subject: [PATCH 04/18] Nationality is now a free form field --- schemas/temporary-teacher-application.json | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index ee47eac..758a415 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -56,17 +56,9 @@ }, { "name": "nationality", - "type": "array", + "type": "string", "label": "Nationality", - "required": true, - "items": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - } - } + "required": true }, { "name": "sex", @@ -274,7 +266,7 @@ "type": "number", "required": true, "validations": { - "min": 1950 + "min": 1930 } }, { @@ -283,7 +275,7 @@ "type": "number", "required": true, "validations": { - "min": 1950 + "min": 1930 } }, { @@ -327,7 +319,7 @@ "type": "number", "required": true, "validations": { - "min": 1950 + "min": 1930 } }, { @@ -371,7 +363,7 @@ "type": "number", "required": true, "validations": { - "min": 1950 + "min": 1930 } }, { @@ -380,7 +372,7 @@ "type": "number", "required": false, "validations": { - "min": 1950 + "min": 1930 } }, { From fffa93e9d087af8dbf31ccd9aa1ed98ebeccfd4b Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 12 Jan 2026 20:19:46 -0400 Subject: [PATCH 05/18] Made residency duration its own proper page --- schemas/temporary-teacher-application.json | 21 ++++++++++++++------- src/email/templates/.djlintrc | 8 ++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 src/email/templates/.djlintrc diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index 758a415..340a599 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -130,13 +130,20 @@ }, { "name": "barbadosResidencyDuration", - "label": "How long have you lived in Barbados?", - "type": "string", - "required": true, - "validations": { - "min": 2, - "max": 20 - } + "type": "object", + "required": false, + "fields": [ + { + "name": "residencyDuration", + "label": "How long have you lived in Barbados?", + "type": "number", + "required": true, + "validations": { + "min": 2, + "max": 20 + } + } + ] }, { "name": "contactDetails", diff --git a/src/email/templates/.djlintrc b/src/email/templates/.djlintrc new file mode 100644 index 0000000..ec297a7 --- /dev/null +++ b/src/email/templates/.djlintrc @@ -0,0 +1,8 @@ +{ + "extension": "html.hbs", + "indent": "2", + "format_css": true, + "css": { + "indent_size": 4 + } +} From 08e41c30b074194e78220949504fc0135915182c Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Thu, 15 Jan 2026 16:37:20 -0400 Subject: [PATCH 06/18] Will now consistently use camel case for name fields --- schemas/temporary-teacher-application.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index 340a599..598035c 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -251,7 +251,7 @@ ] }, { - "name": "applicant-education", + "name": "applicantEducation", "type": "object", "required": true, "fields": [ From 3554183c0fdd7da897e25cc1d194fb1360377229 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 12:08:57 -0400 Subject: [PATCH 07/18] Removed my linting configuration --- .gitignore | 3 ++- src/email/templates/.djlintrc | 8 -------- 2 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 src/email/templates/.djlintrc diff --git a/.gitignore b/.gitignore index ea48d65..00d593e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,4 +34,5 @@ lerna-debug.log* !.vscode/launch.json !.vscode/extensions.json -.env \ No newline at end of file +.env +.djlintrc diff --git a/src/email/templates/.djlintrc b/src/email/templates/.djlintrc deleted file mode 100644 index ec297a7..0000000 --- a/src/email/templates/.djlintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extension": "html.hbs", - "indent": "2", - "format_css": true, - "css": { - "indent_size": 4 - } -} From a07929e0a1d056cf3bd4e19ff32ade0b1d2d930b Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 13:17:18 -0400 Subject: [PATCH 08/18] Updated schema for Backend Validation --- schemas/temporary-teacher-application.json | 272 +++++---------------- 1 file changed, 67 insertions(+), 205 deletions(-) diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index 598035c..a260986 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -62,19 +62,9 @@ }, { "name": "sex", - "type": "select", + "type": "string", "label": "Sex", "required": true, - "options": [ - { - "label": "Male", - "value": "male" - }, - { - "label": "Female", - "value": "female" - } - ], "validations": { "regex": "^(male|female)$", "message": "Must select a valid sex" @@ -82,23 +72,9 @@ }, { "name": "martialStatus", - "type": "select", + "type": "string", "label": "Martial status", "required": true, - "options": [ - { - "label": "Single", - "value": "single" - }, - { - "label": "Married", - "value": "married" - }, - { - "label": "Divorced", - "value": "divorced" - } - ], "validations": { "regex": "^(single|married|divorced)$", "message": "Must select a martial status" @@ -167,70 +143,29 @@ "type": "select", "label": "Country", "required": true, - "options": [ - { - "label": "Barbados", - "value": "barbados" - } - ] + "validations": { + "regex": "^barbados$" + } }, { "name": "parish", - "type": "select", + "type": "string", "label": "Parish", "required": true, - "options": [ - { - "value": "christ-church", - "label": "Christ Church" - }, - { - "value": "st-andrew", - "label": "St Andrew" - }, - { - "value": "st-george", - "label": "St George" - }, - { - "value": "st-james", - "label": "St James" - }, - { - "value": "st-john", - "label": "St John" - }, - { - "value": "st-joseph", - "label": "St Joseph" - }, - { - "value": "st-lucy", - "label": "St Lucy" - }, - { - "value": "st-michael", - "label": "St Michael" - }, - { - "value": "st-peter", - "label": "St Peter" - }, - { - "value": "st-philip", - "label": "St Philip" - }, - { - "value": "st-thomas", - "label": "St Question, so for boolean Thomas" - } - ] - }, - { - "name": "postcode", - "type": "string", - "label": "Postcode", - "required": false + "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": "postalCode", + "type": "string", + "label": "Postal Code", + "required": false, + "validations": { + "regex": "^BB\\d{5}$", + "message": "Enter a valid postal code (e.g., BB17004)" + } }, { "name": "emailAddress", @@ -242,11 +177,7 @@ "name": "telephoneNumber", "type": "string", "label": "Telephone Number", - "required": true, - "validations": { - "regex": "^\\+?[0-9]{10,15}$", - "message": "Telephone number must be 10-15 digits" - } + "required": true } ] }, @@ -288,18 +219,12 @@ { "name": "anotherEducation", "label": "Do you want to add another education experience?", - "type": "boolean", + "type": "string", "required": true, - "options": [ - { - "label": "Yes", - "value": "yes" - }, - { - "label": "No", - "value": "no" - } - ] + "validations": { + "regex": "^(yes|no)$", + "message": "Must select an option" + } } ] }, @@ -338,12 +263,11 @@ { "name": "anotherQualification", "label": "Do you want to add another qualification", - "type": "boolean", + "type": "string", "required": true, - "options": [ - "Yes", - "No" - ] + "validations": { + "regex": "^(yes|no)$" + } } ] }, @@ -397,12 +321,12 @@ { "name": "anotherExperience", "required": true, - "type": "boolean", + "type": "string", "label": "Do you want to add another experience?", - "options": [ - "Yes", - "No" - ] + "validations": { + "regex": "^(yes|no)$", + "message": "Must select an option" + } } ] }, @@ -446,21 +370,11 @@ "name": "title", "label": "Title", "required": true, - "type": "select", - "options": [ - { - "label": "Mr", - "value": "mr" - }, - { - "label": "Mrs", - "value": "mrs" - }, - { - "label": "Miss", - "value": "miss" - } - ] + "type": "string", + "validations": { + "regex": "^(mr|ms|mrs)$", + "message": "Must select a valid title" + } }, { "name": "firstName", @@ -496,73 +410,33 @@ }, { "name": "country", - "type": "select", + "type": "string", "label": "Country", "required": true, - "options": [ - { - "label": "Barbados", - "value": "barbados" - } - ] + "validations": { + "regex": "^(barbados)$", + "message": "Must select an option" + } }, { "name": "parish", "type": "select", "label": "Parish", "required": true, - "options": [ - { - "value": "christ-church", - "label": "Christ Church" - }, - { - "value": "st-andrew", - "label": "St Andrew" - }, - { - "value": "st-george", - "label": "St George" - }, - { - "value": "st-james", - "label": "St James" - }, - { - "value": "st-john", - "label": "St John" - }, - { - "value": "st-joseph", - "label": "St Joseph" - }, - { - "value": "st-lucy", - "label": "St Lucy" - }, - { - "value": "st-michael", - "label": "St Michael" - }, - { - "value": "st-peter", - "label": "St Peter" - }, - { - "value": "st-philip", - "label": "St Philip" - }, - { - "value": "st-thomas", - "label": "St Question, so for boolean Thomas" - } - ] - }, - { - "name": "postcode", - "type": "string", - "label": "Postcode", - "required": false + "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": "postalCode", + "type": "string", + "label": "Postal code", + "required": false, + "validations": { + "regex": "^BB\\d{5}$", + "message": "Enter a valid postal code (e.g., BB17004)" + } }, { "name": "occupation", @@ -580,21 +454,17 @@ "name": "telephoneNumber", "type": "string", "label": "Telephone Number", - "required": true, - "validations": { - "regex": "^\\+?[0-9]{10,15}$", - "message": "Telephone number must be 10-15 digits" - } + "required": true }, { "name": "anotherReference", "required": true, - "type": "boolean", + "type": "string", "label": "Do you want to add another reference?", - "options": [ - "Yes", - "No" - ] + "validations": { + "regex": "^(yes|no)$", + "message": "Must select a valid option" + } } ] }, @@ -607,7 +477,7 @@ "name": "certificateDiplomaTranscript", "label": "Upload your certificates, diplomas, and transcripts", "required": true, - "type": "object" + "type": "string" }, { "name": "testimonials", @@ -615,15 +485,7 @@ "required": true, "type": "array", "items": { - "type": "object", - "properties": { - "file1": { - "type": "file" - }, - "file2": { - "type": "file" - } - } + "type": "string" } } ] From 158348733fe992474f9190a6c20605f96aa57fb1 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 15:34:56 -0400 Subject: [PATCH 09/18] Added support for receipt email --- schemas/temporary-teacher-application.json | 18 ++- .../temporary-teacher-application-receipt.hbs | 122 ++++++++++++++++++ 2 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 src/email/templates/temporary-teacher-application-receipt.hbs diff --git a/schemas/temporary-teacher-application.json b/schemas/temporary-teacher-application.json index a260986..c706389 100644 --- a/schemas/temporary-teacher-application.json +++ b/schemas/temporary-teacher-application.json @@ -71,13 +71,13 @@ } }, { - "name": "martialStatus", + "name": "maritalStatus", "type": "string", - "label": "Martial status", + "label": "Marital status", "required": true, "validations": { "regex": "^(single|married|divorced)$", - "message": "Must select a martial status" + "message": "Must select a marital status" } }, { @@ -122,7 +122,7 @@ ] }, { - "name": "contactDetails", + "name": "contact", "type": "object", "required": true, "fields": [ @@ -496,9 +496,17 @@ "type": "email", "config": { "to": "{{db:temporary-teacher-application:admin_email}}", - "subject": "New Temporary Teacher Application - {{formData.firstName}} {{formData.lastName}}", + "subject": "New Temporary Teacher Application - {{formData.applicant.firstName}} {{formData.applicant.lastName}}", "template": "temporary-teacher-application" } + }, + { + "type": "email", + "config": { + "to": "{{formData.contact.emailAddress}}", + "subject": "Application Received - Government of Barbados", + "template": "temporary-teacher-application-receipt" + } } ] } diff --git a/src/email/templates/temporary-teacher-application-receipt.hbs b/src/email/templates/temporary-teacher-application-receipt.hbs new file mode 100644 index 0000000..41271b0 --- /dev/null +++ b/src/email/templates/temporary-teacher-application-receipt.hbs @@ -0,0 +1,122 @@ + + + + + + +
+

Application Submitted: Temporary Teacher

+
+
+
+

+ Dear applicant, +
+ Your application to be a temporary teacher has been submitted. +
+ Your application reference number is {{ referenceNumber }}. +

+

+ We will review your application. +
+ If we need more information or supporting documents, we will contact you using the details you provided. +

+
+
+ + + From 52a1d672ad00a6a666481e0a1f555510bbcf924c Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 15:35:06 -0400 Subject: [PATCH 10/18] Started development on Admin email --- .../temporary-teacher-application.hbs | 196 ++++++++---------- 1 file changed, 89 insertions(+), 107 deletions(-) diff --git a/src/email/templates/temporary-teacher-application.hbs b/src/email/templates/temporary-teacher-application.hbs index 41271b0..fca78c9 100644 --- a/src/email/templates/temporary-teacher-application.hbs +++ b/src/email/templates/temporary-teacher-application.hbs @@ -1,122 +1,104 @@ -
-

Application Submitted: Temporary Teacher

+

🧑‍🏫 Temporary Teacher Application

+

A new Temporary Teacher Application has been submitted.

+
Applicant Information
+
+ Name: + {{ applicant.firstName }} {{ applicant.lastName }} +
+
+ Date of Birth: + {{ applicant.dateOfBirth }} +
+
+ Place of Birth: + {{ applicant.placeOfBirth }} +
+
+ Nationality: + {{ applicant.nationality }} +
+
+ Gender: + {{ applicant.sex }} +
+
+ Marital Status: + {{ applicant.maritalStatus }} +
+ {{#if applicant.nationalIdNumber}} +
+ National ID Number: + {{ applicant.nationalIdNumber }} +
+ {{/if}} + {{#if applicant.passportNumber}} +
+ Passport Number: + {{ applicant.passportNumber }} +
+ {{/if}} +
+ National Insurance Number: + {{ applicant.nationalInsuranceNumber }} +
+
+
+
Barbados Residency Duartion:
+
+
How long have they lived in Barbados
+
{{ barbadosResidencyDuration.residencyDuration }}
+
+
+
+
Contact Information
+
+
Address
+
+ {{ contact.addressLine1 }} + {{#if contact.addressLine2 }} + {{ contact.addressLine2 }} + {{/if}} +
+
+
+
Country
+
{{ contact.country }}
+
+
+
Parish
+
{{ contact.parish }}
+
+ {{#if contact.postalCode }} +
+
Postal Code
+
{{ contact.postalCode }}
+
+ {{/if}} +
+
Email Address
+
{{ contact.emailAddress }}
+
+
+
Telephone Number
+
{{ contact.telephoneNumber }}
+
+
+
- From a28ed418be0c25adec7ab7cd6a48e76c10997e95 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 18:45:27 -0400 Subject: [PATCH 11/18] Added script to help building admin email templates --- scripts/admin_email_create.ps1 | 119 +++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 scripts/admin_email_create.ps1 diff --git a/scripts/admin_email_create.ps1 b/scripts/admin_email_create.ps1 new file mode 100644 index 0000000..2a42b71 --- /dev/null +++ b/scripts/admin_email_create.ps1 @@ -0,0 +1,119 @@ +# Command line args + +param ( + [Parameter(Mandatory=$true)] + [string]$FormId +) + +# Functions + +function ConvertFrom-Field-To-HBS +{ + [CmdletBinding()] + param( + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] + [string] $SectionName, + [Parameter(Mandatory, ValueFromPipelineByPropertyName)] + [PsCustomObject]$Field + + ) + + process + { + $fieldInfo = [PsCustomObject]@{ + name = $Field.name + type = $Field.type + label = $Field.label + required = $Field.required + } + + $fieldValue = "$SectionName.$($fieldInfo.name)" + + $fieldHbs = @" +
+ $($fieldInfo.label) + {{$fieldValue}} +
+"@ + + if (-not $fieldInfo.required) + { + $fieldHbs = @" + {{#if $fieldValue}} + $fieldHbs + {{/if}} +"@ + } + + return $fieldHbs + } +} + +function ConvertFrom-Section-To-HBS +{ + [CmdletBinding()] + param( + [Parameter(Mandatory, ValueFromPipeline)] + [pscustomobject]$Section + ) + + process + { + $fields = foreach ($field in $Section.fields) + { + [pscustomobject]@{ + SectionName = $Section.name + Field = $field + } + } + + $HBSFields = $fields | ConvertFrom-Field-To-HBS + $HBSFieldsText = $HBSFields -join "`n" + + $sectionStr = @" +
+
$($Section.name)
+ $HBSFieldsText +
+"@ + return $sectionStr + } +} + +# Constants + +$schemaLocations = "." +$templateFile = "./admin-email-template.tmp" +$outputDir = "." + + +# Obtain title from FormId + +$title = $FormId.Replace("-", " ") +$title = (Get-Culture).TextInfo.ToTitleCase($title) + +# Set files + +$schemaFile = Join-Path -Path $schemaLocations -ChildPath "$FormId.json" +$outputFile = Join-Path -Path $outputDir -ChildPath "$FormID.hbs" + +# Read in the JSON Schema + +$schema = Get-Content $schemaFile -Raw | ConvertFrom-Json +$allFields = $schema.fields + +# Now we need to go through each record and do parsing. + +$sections = $allFields | ConvertFrom-Section-To-HBS + +# Write-Output $sections + +# Get Template Content and add values + +$template = Get-Content $templateFile -Raw + +$template = $template.Replace("{! Title !}", $title) +$template = $template.Replace("{! Sections !}", $sections) + +Set-Content -Path $outputFile -Value $template + From 1deab57849022d1b82403a0b576cb7ea8404adf6 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 18:45:49 -0400 Subject: [PATCH 12/18] Added script to package.json for simplified execution --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 96a81e6..78ebe56 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "db:migrate": "npm run typeorm migration:run -- -d src/database/datasource.ts", "db:revert": "npm run typeorm migration:revert -- -d src/database/datasource.ts", "db:drop": "npm run typeorm schema:drop -- -d src/database/datasource.ts", - "db:migrate:prod": "node ./node_modules/typeorm/cli migration:run -d ./dist/database/datasource.js" + "db:migrate:prod": "node ./node_modules/typeorm/cli migration:run -d ./dist/database/datasource.js", + "template:create-admin-email": "pwsh ./scripts/admin_email_create.ps1" }, "dependencies": { "@aws-sdk/client-s3": "^3.954.0", From 44c893f1d66ccaeaae1152086dda74bd7b4d7410 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 18:49:05 -0400 Subject: [PATCH 13/18] Added template file to be referenced --- scripts/templates/admin_email_template.tmp | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 scripts/templates/admin_email_template.tmp diff --git a/scripts/templates/admin_email_template.tmp b/scripts/templates/admin_email_template.tmp new file mode 100644 index 0000000..d7a8504 --- /dev/null +++ b/scripts/templates/admin_email_template.tmp @@ -0,0 +1,88 @@ + + + + + + +
+

{! Title !} Application

+
+
+

A new {! Title !} Application has been submitted.

+ {! Sections !} + +
+ + From 4938b48b1a61bd4480fe7ab1f21e1f51a5190a70 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 18:49:51 -0400 Subject: [PATCH 14/18] Updated code to match directory structure --- scripts/admin_email_create.ps1 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/admin_email_create.ps1 b/scripts/admin_email_create.ps1 index 2a42b71..efad888 100644 --- a/scripts/admin_email_create.ps1 +++ b/scripts/admin_email_create.ps1 @@ -5,6 +5,12 @@ param ( [string]$FormId ) +# Constants + +$schemaLocations = "./schemas" # Start location is where `npm run` is executed +$templateFile = "./scripts/templates/admin_email_template.tmp" +$outputDir = "./src/email/templates/" + # Functions function ConvertFrom-Field-To-HBS @@ -15,7 +21,6 @@ function ConvertFrom-Field-To-HBS [string] $SectionName, [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [PsCustomObject]$Field - ) process @@ -80,12 +85,6 @@ function ConvertFrom-Section-To-HBS } } -# Constants - -$schemaLocations = "." -$templateFile = "./admin-email-template.tmp" -$outputDir = "." - # Obtain title from FormId From 5cddf95335a055c1c57dc6de78ea41961a1863dd Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 19:06:44 -0400 Subject: [PATCH 15/18] Will now handle if application is part of the ID --- scripts/admin_email_create.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/admin_email_create.ps1 b/scripts/admin_email_create.ps1 index efad888..da4a6ea 100644 --- a/scripts/admin_email_create.ps1 +++ b/scripts/admin_email_create.ps1 @@ -89,6 +89,7 @@ function ConvertFrom-Section-To-HBS # Obtain title from FormId $title = $FormId.Replace("-", " ") +$title = $title.Replace(" application", "") $title = (Get-Culture).TextInfo.ToTitleCase($title) # Set files From 6a0ff793c259c75c18805e9f3b24ef19e81838b7 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 19:30:56 -0400 Subject: [PATCH 16/18] Added a readme --- scripts/README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scripts/README.md diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..6a295b4 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,33 @@ +# Form-Processor-Api Scripts + +This document seeks to outline custom scripts developed to automate certain processes within the `form-processor-api` service. + +This folder provides the following structure: + +- `templates/`: Directory for any template files used by scripts +- `README.md`: This File +- `*.ps1/*.js`: Script files that accomplish some task. + + +## Admin Email Template Creation + +This script is called `admin_email_create.ps1`, and is used to quickly scaffold admin email templates, given a schema from `../schemas/`. + +### Using the Script + +In this project, the script is intended to be used by running: + +`npm run template:create-admin-email` + +However, the prompt for a form id can be skipped by running: + +`npm run template:create-admin-email -- -FormId id-of-form` + +For example: + +`npm run template:create-admin-email -- -FormId jobstart-plus-programme` + +The script can also be run manually from this directory by using `pwsh ./admin_email_create.ps1`, however, no command line configuration is provided to allow for moving to different directories. + +> [!NOTE] +> I also have not added error handling to the script. Will have that as a TODO. From 731ef92fe902c4bc995b9e7f1e16e4a5fc51959b Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 19:36:32 -0400 Subject: [PATCH 17/18] Added a colon after field name --- scripts/admin_email_create.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/admin_email_create.ps1 b/scripts/admin_email_create.ps1 index da4a6ea..f6c9cca 100644 --- a/scripts/admin_email_create.ps1 +++ b/scripts/admin_email_create.ps1 @@ -36,7 +36,7 @@ function ConvertFrom-Field-To-HBS $fieldHbs = @"
- $($fieldInfo.label) + $($fieldInfo.label): {{$fieldValue}}
"@ From b2a3cfba1ce37f069e56c68605d10ef89d542a18 Mon Sep 17 00:00:00 2001 From: IsaiahSama Date: Mon, 19 Jan 2026 20:15:58 -0400 Subject: [PATCH 18/18] Updated readme with known issues --- scripts/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/README.md b/scripts/README.md index 6a295b4..a2a6d23 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -12,6 +12,7 @@ This folder provides the following structure: ## Admin Email Template Creation This script is called `admin_email_create.ps1`, and is used to quickly scaffold admin email templates, given a schema from `../schemas/`. +This is a powershell script, and will require Powershell to be installed, along with being able to run the `pwsh` command. ### Using the Script @@ -31,3 +32,9 @@ The script can also be run manually from this directory by using `pwsh ./admin_e > [!NOTE] > I also have not added error handling to the script. Will have that as a TODO. + +### Known Issues + +1. Does not yet handle missing files, or any errors resulting from such +1. You will still need to perform manual edits, such as merging First Name, Last Name, and Middle Names into one field, and fixing the casing for `section-title`s. +1. Requires Powershell