22import { APIGatewayProxyEvent , APIGatewayProxyResult } from "aws-lambda"
33import { Logger } from "@aws-lambda-powertools/logger"
44import { injectLambdaContext } from "@aws-lambda-powertools/logger/middleware"
5+ import { TransactionCanceledException } from "@aws-sdk/client-dynamodb"
6+
57import middy from "@middy/core"
68import inputOutputLogger from "@middy/input-output-logger"
7- import errorHandler from "@nhs/fhir-middy-error-handler"
89import httpHeaderNormalizer from "@middy/http-header-normalizer"
10+
11+ import errorHandler from "@nhs/fhir-middy-error-handler"
912import { Bundle , BundleEntry , Task } from "fhir/r4"
13+
14+ import { transactionBundle , validateEntry } from "./validation/content"
1015import { getPreviousItem , persistDataItems } from "./utils/databaseClient"
1116import { jobWithTimeout , hasTimedOut } from "./utils/timeoutUtils"
12- import { transactionBundle , validateEntry } from "./validation/content "
17+ import { pushPrescriptionToNotificationSQS } from "./utils/sqsClient "
1318import {
1419 accepted ,
1520 badRequest ,
@@ -19,7 +24,6 @@ import {
1924 serverError ,
2025 timeoutResponse
2126} from "./utils/responses"
22- import { TransactionCanceledException } from "@aws-sdk/client-dynamodb"
2327import {
2428 InterceptionResult ,
2529 testPrescription1Intercept ,
@@ -159,6 +163,10 @@ const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayPro
159163 return response ( 500 , responseEntries )
160164 }
161165
166+ // This prescription was handled successfully,
167+ // so add a message to the notifications SQS
168+ pushPrescriptionToNotificationSQS ( dataItems )
169+
162170 return response ( 201 , responseEntries )
163171}
164172
0 commit comments