Skip to content

Commit 74e5713

Browse files
committed
fix: new index for post dated
1 parent b0a05ab commit 74e5713

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

SAMtemplates/tables/main.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ Resources:
184184
- TerminalStatus
185185
- LastModified
186186
- Status
187-
# TODO: Remove this when we deprecate post dated prescriptions.
188-
- PostDatedLastModifiedSetAt
189187
ProjectionType: INCLUDE
190188
ProvisionedThroughput: !If
191189
- EnableDynamoDBAutoScalingCondition
@@ -222,6 +220,27 @@ Resources:
222220
- ReadCapacityUnits: 1
223221
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
224222
- !Ref "AWS::NoValue"
223+
- IndexName: PharmacyODSCodePrescriptionIDIndexIncPostDated
224+
KeySchema:
225+
- AttributeName: PharmacyODSCode
226+
KeyType: HASH
227+
- AttributeName: PrescriptionID
228+
KeyType: RANGE
229+
Projection:
230+
NonKeyAttributes:
231+
- PatientNHSNumber
232+
- LineItemID
233+
- TerminalStatus
234+
- LastModified
235+
- Status
236+
# TODO: Remove this when we deprecate post dated prescriptions.
237+
- PostDatedLastModifiedSetAt
238+
ProjectionType: INCLUDE
239+
ProvisionedThroughput: !If
240+
- EnableDynamoDBAutoScalingCondition
241+
- ReadCapacityUnits: 1
242+
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
243+
- !Ref "AWS::NoValue"
225244
Tags:
226245
- Key: "EPS-Tablename"
227246
Value: "PrescriptionStatusUpdates"

packages/gsul/src/dynamoDBclient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export async function getItemsUpdatesForPrescription(
5050
export function createQueryCommandInput(odsCode: string, prescriptionID: string): QueryCommandInput {
5151
return {
5252
TableName: tableName,
53-
IndexName: "PharmacyODSCodePrescriptionIDIndex",
53+
// TODO: revert to PharmacyODSCodePrescriptionIDIndex once post-dated no longer required
54+
IndexName: "PharmacyODSCodePrescriptionIDIndexIncPostDated",
5455
KeyConditionExpression: "PrescriptionID = :inputPrescriptionID AND PharmacyODSCode = :inputPharmacyODSCode",
5556
ExpressionAttributeValues: {
5657
":inputPharmacyODSCode": odsCode.toUpperCase(),

packages/gsul/tests/testRunDynamoDBQueries.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("testing dynamoDBClient", () => {
4848

4949
const expected = {
5050
TableName: undefined,
51-
IndexName: "PharmacyODSCodePrescriptionIDIndex",
51+
IndexName: "PharmacyODSCodePrescriptionIDIndexIncPostDated",
5252
KeyConditionExpression: "PrescriptionID = :inputPrescriptionID AND PharmacyODSCode = :inputPharmacyODSCode",
5353
ExpressionAttributeValues: {
5454
":inputPharmacyODSCode": "ODSCODE",

0 commit comments

Comments
 (0)