#5849 - Form Submissions, Appeals and Change requests notifications#5895
#5849 - Form Submissions, Appeals and Change requests notifications#5895tiago-graf wants to merge 17 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new GC Notify email notifications to support the updated workflows around form submissions, student appeals, and application change requests.
Changes:
- Introduced 4 new
NotificationMessageTypevalues (36–39) and seedednotification_messageswith corresponding templates. - Added notification action methods to create ministry/student notifications for change requests and form/appeal submissions/completions.
- Updated student appeal, form submission, and change request services + e2e specs to generate/validate the new notifications (including friendly form names and category labels).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| sources/packages/backend/libs/sims-db/src/entities/notification.model.ts | Adds new notification message type IDs (36–39). |
| sources/packages/backend/libs/services/src/notifications/notification/notification.model.ts | Adds the payload model for “ministry form submitted” notifications. |
| sources/packages/backend/libs/services/src/notifications/notification/notification-actions.service.ts | Implements new notification creation methods for change requests and form/appeal events. |
| sources/packages/backend/libs/services/src/constants/notification.constants.ts | Adds constants used by tests for template IDs and ministry-facing form category labels. |
| sources/packages/backend/libs/services/src/constants/index.ts | Exposes the new notification constants. |
| sources/packages/backend/apps/db-migrations/src/sql/NotificationMessages/Insert-appeal-change-request-notification-messages.sql | Seeds notification message records for IDs 36–39. |
| sources/packages/backend/apps/db-migrations/src/sql/NotificationMessages/Rollback-insert-appeal-change-request-notification-messages.sql | Rollback script for the new seed data. |
| sources/packages/backend/apps/db-migrations/src/migrations/1773355579843-InsertAppealChangeRequestNotificationMessages.ts | Migration to apply/rollback the new notification message seeds. |
| sources/packages/backend/apps/api/src/services/student-appeal/student-appeal.service.ts | Sends either legacy change-request or new appeal “form submitted” ministry notification based on program year; maps technical to friendly form names. |
| sources/packages/backend/apps/api/src/services/student-appeal/student-appeal-assessment/student-appeal-assessment.service.ts | Sends the correct student notification on assessment completion (legacy vs new). |
| sources/packages/backend/apps/api/src/services/form-submission/form-submission.models.ts | Extends submission config typing to include formType for friendly names. |
| sources/packages/backend/apps/api/src/services/form-submission/form-submission-submit.service.ts | Sends ministry “form submitted” notification on submission creation. |
| sources/packages/backend/apps/api/src/services/form-submission/form-submission-approval.service.ts | Sends student “form completed” notification when adjudication completes. |
| sources/packages/backend/apps/api/src/services/dynamic-form-configuration/dynamic-form-configuration.service.ts | Adds lookup by form definition name to support friendly form name mapping. |
| sources/packages/backend/apps/api/src/services/application/application.service.ts | Sends ministry change request submitted notification when change request is created. |
| sources/packages/backend/apps/api/src/services/application-change-request/application-change-request.service.ts | Sends student change request review completed notification when assessed. |
| sources/packages/backend/apps/api/src/route-controllers/student-appeal/tests/e2e/student-appeal.students.controller.submitStudentAppeal.e2e-spec.ts | Updates/validates ministry notification for student-only appeals (Other appeal). |
| sources/packages/backend/apps/api/src/route-controllers/student-appeal/tests/e2e/student-appeal.students.controller.submitApplicationAppeal.e2e-spec.ts | Adds coverage for legacy vs 2025-26+ program year notifications on submission. |
| sources/packages/backend/apps/api/src/route-controllers/student-appeal/tests/e2e/student-appeal.aest.controller.approveStudentAppealRequests.e2e-spec.ts | Validates student notifications for completed appeal assessment (legacy vs new). |
| sources/packages/backend/apps/api/src/route-controllers/application-change-request/tests/e2e/application-change-request.aest.controller.assessApplicationChangeRequest.e2e-spec.ts | Validates student notification for change request review completion. |
You can also share your feedback on Copilot code review. Take the survey.
...ckend/apps/api/src/services/application-change-request/application-change-request.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/services/src/constants/notification.constants.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/apps/api/src/services/student-appeal/student-appeal.service.ts
Outdated
Show resolved
Hide resolved
.../db-migrations/src/migrations/1773355579843-InsertAppealChangeRequestNotificationMessages.ts
Show resolved
Hide resolved
...ackages/backend/libs/services/src/notifications/notification/notification-actions.service.ts
Outdated
Show resolved
Hide resolved
...ces/packages/backend/apps/api/src/services/form-submission/form-submission-submit.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/apps/api/src/services/application/application.service.ts
Outdated
Show resolved
Hide resolved
...ckend/apps/api/src/services/application-change-request/application-change-request.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/apps/api/src/services/application/application.service.ts
Outdated
Show resolved
Hide resolved
| formCategory: FormCategory, | ||
| entityManager: EntityManager, | ||
| ): Promise<void> { | ||
| // Load student info required for the notification. |
There was a problem hiding this comment.
These two queries can be executed as follows and provide friendly error messages.
const student = await entityManager.getRepository(Student).findOneOrFail({
select: {
id: true,
birthDate: true,
user: { id: true, firstName: true, lastName: true, email: true },
applications: { id: true, applicationNumber: true },
},
relations: { user: true, applications: true },
where: {
id: studentId,
applications: { id: applicationId },
},
});
if(!student){
throw new Error("Student not found while sending notification.");
}
if(applicationId && !student.application){
throw new Error("Application not found found while sending notification.");
}There was a problem hiding this comment.
Was this suggestion accepted? I am not able to see the change.
There was a problem hiding this comment.
I had to adapt it since the applications is 1-N relation
...ces/packages/backend/apps/api/src/services/form-submission/form-submission-submit.service.ts
Outdated
Show resolved
Hide resolved
sources/packages/backend/libs/test-utils/src/constants/notification.constants.ts
Show resolved
Hide resolved
sources/packages/backend/libs/services/src/constants/notification.constants.ts
Outdated
Show resolved
Hide resolved
...grations/src/sql/NotificationMessages/Insert-appeal-change-request-notification-messages.sql
Outdated
Show resolved
Hide resolved
sources/packages/backend/apps/api/src/services/student-appeal/student-appeal.service.ts
Outdated
Show resolved
Hide resolved
| * Student submitted appeal. | ||
| */ | ||
| StudentSubmittedChangeRequestNotification = 18, | ||
| StudentSubmittedAppealNotification = 18, |
There was a problem hiding this comment.
Renamed since this is now a appeal specific notification
| * Ministry completes updating an appeal requested by student. | ||
| */ | ||
| MinistryCompletesChange = 5, | ||
| MinistryCompletesAppeal = 5, |
There was a problem hiding this comment.
Renamed since this is now a appeal specific notification
| } | ||
|
|
||
| /** | ||
| * Sends a ministry notification when a student submits a new program year change request. |
There was a problem hiding this comment.
The "program year" in the comment seems to be misleading.
Please adjust it as follows.
Sends a ministry notification when a student submits a change request (edit post-COE).
| * @param formDefinitionName form definition name. | ||
| * @returns dynamic form configuration for the requested form definition name. | ||
| */ | ||
| getFormByDefinitionName( |
There was a problem hiding this comment.
This method can be removed now.
...i/src/services/student-appeal/student-appeal-assessment/student-appeal-assessment.service.ts
Show resolved
Hide resolved
| * Ministry notification data when a student submits a form or appeal, | ||
| * with form type categorization (application appeal, other appeal, standard form), | ||
| * a comma-separated list of human-readable form names, and the related application number. | ||
| */ |
There was a problem hiding this comment.
Comments should be reviewed: "(application appeal, other appeal, standard form)" is no longer valid, and "form or appeal" is not required.
| beforeEach(async () => { | ||
| MockDate.reset(); | ||
| // Mark all existing student appeal notifications as sent to isolate test assertions. | ||
| await db.notification.update( |
There was a problem hiding this comment.
These can be combined as below.
await db.notification.update(
{
notificationMessage: {
id: In([
NotificationMessageType.StudentChangeRequestReviewCompleted,
NotificationMessageType.MinistryAppealCompleted,
]),
},
},
{ dateSent: new Date() },
);| studentFileRepo = dataSource.getRepository(StudentFile); | ||
| recentActiveProgramYear = await getRecentActiveProgramYear(db); | ||
| // Update fake email contacts to send ministry notifications. | ||
| await db.notificationMessage.update( |
There was a problem hiding this comment.
andrewsignori-aot
left a comment
There was a problem hiding this comment.
Thanks for making the changes and for the effort in tracking the different notifications for the different features. Minor comments left, please take a look.
|



Summary
Introduces email notifications via GC Notify for key events in the form submission, student appeal, and application change request workflows.
New notification types (IDs 36–39):
MinistryChangeRequestSubmitted (36) — Notifies the ministry when a student submits a legacy change request.
StudentChangeRequestReviewCompleted (37) — Notifies the student when their change request or appeal review is complete.
MinistryFormSubmitted (38) — Notifies the ministry when a student submits a new appeal or standard form, including the form category (application appeal, other appeal, or standard form) and human-readable form names.
StudentFormCompleted (39) — Notifies the student when their submitted form adjudication is finalized.
Updated notification types (IDs 5, 18)
MinistryAppealCompleted (5) - Renamed from "MinistryCompletesChange"
StudentAppealSubmitted (18) - Renamed from "StudentSubmittedChangeRequestNotification"