[HOTE-983] feat: Generate Notification: Order Dispatched#316
Open
[HOTE-983] feat: Generate Notification: Order Dispatched#316
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds “Order Dispatched” notification generation to the order-status ingestion flow, extending the lambdas package with new message-building and DB/audit utilities and wiring local infra env vars to support local execution.
Changes:
- Enqueue a Notify message to SQS when an order receives its first
DISPATCHEDstatus, and write a notification audit entry. - Introduce
NotifyEventCode.OrderDispatchedplus supportingNotifyMessageBuilder,PatientDbClient, andNotificationAuditDbClient. - Update local Terraform to provide queue URL and base URL env vars to
order-status-lambda.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| local-environment/infra/main.tf | Adds env vars for notify queue URL and home test base URL for local order-status lambda. |
| lambdas/src/order-status-lambda/notify-message-builder.ts | Builds the ORDER_DISPATCHED notify payload (recipient lookup + personalisation). |
| lambdas/src/order-status-lambda/notify-message-builder.test.ts | Unit tests for message construction, date formatting, and base URL normalisation. |
| lambdas/src/order-status-lambda/init.ts | Wires new DB clients, SQS client, message builder, and env var retrieval into DI. |
| lambdas/src/order-status-lambda/init.test.ts | Extends init wiring tests for the new dependencies/env vars. |
| lambdas/src/order-status-lambda/index.ts | Sends dispatched notification on first DISPATCHED status; inserts notification audit entry. |
| lambdas/src/order-status-lambda/index.test.ts | Adds handler tests covering notification send / suppression behavior. |
| lambdas/src/lib/types/notify-message.ts | Adds OrderDispatched event code to the notify message model. |
| lambdas/src/lib/db/patient-db-client.ts | Adds DB lookup for notify recipient data (NHS number + DOB) by patient UID. |
| lambdas/src/lib/db/patient-db-client.test.ts | Unit tests for patient recipient lookup and missing-record behavior. |
| lambdas/src/lib/db/order-status-db.ts | Adds isFirstStatusOccurrence() helper used to gate first-time DISPATCHED notifications. |
| lambdas/src/lib/db/order-status-db.test.ts | Adds tests for isFirstStatusOccurrence(); improves DBClient typing in test setup. |
| lambdas/src/lib/db/notification-audit-db-client.ts | Adds insert helper for notification_audit table entries. |
| lambdas/src/lib/db/notification-audit-db-client.test.ts | Unit tests for audit insert behavior and zero-row failure case. |
…of github.com:NHSDigital/hometest-service into feature/hote-983/generate-notify-for-order-dispatched
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
https://nhsd-jira.digital.nhs.uk/browse/HOTE-983
Context
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.