Skip to content

Commit

Permalink
feat: add a new GSI to support the API endpoint returning the submiss…
Browse files Browse the repository at this point in the history
…ion names sorted by creation time (#799)
  • Loading branch information
wmoussa-gc authored Sep 4, 2024
1 parent ab6a87e commit 0e782ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 57 deletions.
13 changes: 13 additions & 0 deletions aws/dynamodb/dynamo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,26 @@ resource "aws_dynamodb_table" "vault" {
type = "S"
}

attribute {
name = "Status#CreatedAt"
type = "S"
}

global_secondary_index {
name = "Status"
hash_key = "FormID"
range_key = "Status"
projection_type = "ALL"
}

global_secondary_index {
name = "StatusCreatedAt"
hash_key = "FormID"
range_key = "Status#CreatedAt"
projection_type = "INCLUDE"
non_key_attributes = ["CreatedAt", "Name"]
}

server_side_encryption {
enabled = true
kms_key_arn = var.kms_key_dynamodb_arn
Expand Down
1 change: 1 addition & 0 deletions lambda-code/reliability/lib/dataLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export async function saveToVault(
CreatedAt: Number(createdAt),
SecurityAttribute: securityAttribute,
Status: "New",
"Status#CreatedAt": `New#${Number(createdAt)}`,
ConfirmationCode: confirmationCode,
Name: name,
FormSubmissionHash: formSubmissionHash,
Expand Down
57 changes: 0 additions & 57 deletions localstack_migration.sh

This file was deleted.

0 comments on commit 0e782ab

Please sign in to comment.