Skip to content

Commit 35ec450

Browse files
authored
Merge branch 'main' into feature/CCM-11192_test_data_FV
2 parents 86fae95 + 2b862fd commit 35ec450

File tree

38 files changed

+4136
-643
lines changed

38 files changed

+4136
-643
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"build": {
3+
"dockerfile": "../scripts/devcontainer/Dockerfile"
4+
},
25
"customizations": {
36
"codespaces": {
47
"openFiles": [
@@ -9,11 +12,7 @@
912
},
1013
"vscode": {
1114
"extensions": [
12-
"ms-dotnettools.csdevkit",
1315
"42crunch.vscode-openapi",
14-
"alefragnani.bookmarks",
15-
"AmazonWebServices.aws-toolkit-vscode",
16-
"chdsbd.github-code-owners",
1716
"davidanson.vscode-markdownlint",
1817
"dbaeumer.vscode-eslint",
1918
"donjayamanne.githistory",
@@ -26,7 +25,6 @@
2625
"github.vscode-github-actions",
2726
"github.vscode-pull-request-github",
2827
"hediet.vscode-drawio",
29-
"johnpapa.vscode-peacock",
3028
"joshx.workspace-terminals",
3129
"maattdd.gitless",
3230
"mhutchie.git-graph",
@@ -40,15 +38,10 @@
4038
"streetsidesoftware.code-spell-checker-british-english",
4139
"takumii.markdowntable",
4240
"tamasfe.even-better-toml",
43-
"tomoki1207.pdf",
44-
"vscjava.vscode-java-pack",
45-
"vscode-icons-team.vscode-icons",
46-
"vstirbu.vscode-mermaid-preview",
4741
"wayou.vscode-todo-highlight",
4842
"yzane.markdown-pdf",
4943
"yzhang.dictionary-completion",
50-
"yzhang.markdown-all-in-one",
51-
"zoma.vscode-auto-open-workspace"
44+
"yzhang.markdown-all-in-one"
5245
],
5346
"settings": {
5447
"[makefile]": {
@@ -77,30 +70,17 @@
7770
"installZsh": true
7871
},
7972
"ghcr.io/devcontainers/features/docker-in-docker:2": {
80-
"azureDnsAutoDetection": true,
8173
"dockerDashComposeVersion": "v2",
8274
"installDockerBuildx": true,
8375
"installDockerComposeSwitch": true,
8476
"moby": true,
8577
"version": "latest"
8678
},
87-
"ghcr.io/devcontainers/features/dotnet:2": {
88-
"aspNetCoreRuntimeVersions": "8.0",
89-
"dotnetRuntimeVersions": "8.0",
90-
"version": "8.0"
91-
},
92-
"ghcr.io/devcontainers/features/go:1": {},
93-
"ghcr.io/devcontainers/features/java:1": {
94-
"version": "17"
95-
},
96-
"ghcr.io/devcontainers/features/node:1": {},
97-
"ghcr.io/devcontainers/features/python:1": {},
9879
"ghcr.io/devcontainers/features/ruby:1": {}
9980
},
100-
"image": "mcr.microsoft.com/devcontainers/base:noble",
10181
"mounts": [
102-
"source=${localEnv:HOME}/.gnupg,target=/home/vscode/.gnupg,type=bind,consistency=cached"
82+
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
10383
],
104-
"name": "Ubuntu",
84+
"name": "Devcontainer",
10585
"postCreateCommand": "scripts/devcontainer/postcreatecommand.sh"
10686
}

.vscode/launch.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"configurations": [
3+
{
4+
"args": [
5+
"${relativeFile}",
6+
"--runInBand"
7+
],
8+
"console": "integratedTerminal",
9+
"cwd": "${workspaceFolder}/${input:workspace}",
10+
"internalConsoleOptions": "neverOpen",
11+
"name": "Debug current test file (pick workspace)",
12+
"program": "${workspaceFolder}/node_modules/.bin/jest",
13+
"request": "launch",
14+
"type": "node"
15+
},
16+
{
17+
"args": [
18+
"${relativeFile}",
19+
"--runInBand",
20+
"--testNamePattern",
21+
"${input:testName}"
22+
],
23+
"console": "integratedTerminal",
24+
"cwd": "${workspaceFolder}/${input:workspace}",
25+
"internalConsoleOptions": "neverOpen",
26+
"name": "Debug single test by name (pick workspace)",
27+
"program": "${workspaceFolder}/node_modules/.bin/jest",
28+
"request": "launch",
29+
"type": "node"
30+
}
31+
],
32+
"inputs": [
33+
{
34+
"description": "Select package workspace to run tests in",
35+
"id": "workspace",
36+
"options": [
37+
"lambdas/api-handler",
38+
"lambdas/authorizer",
39+
"internal/datastore"
40+
],
41+
"type": "pickString"
42+
},
43+
{
44+
"description": "Enter test name regex for --testNamePattern",
45+
"id": "testName",
46+
"type": "promptString"
47+
}
48+
],
49+
"version": "0.0.1"
50+
}

infrastructure/terraform/components/api/locals.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@ locals {
1313
})
1414

1515
destination_arn = "arn:aws:logs:${var.region}:${var.shared_infra_account_id}:destination:nhs-main-obs-firehose-logs"
16+
17+
common_db_access_lambda_env_vars = {
18+
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
19+
LETTER_TTL_HOURS = 24,
20+
SUPPLIER_ID_HEADER = "nhsd-supplier-id"
21+
SUPPLIER_ID_HEADER = "nhsd-correlation-id"
22+
}
1623
}

infrastructure/terraform/components/api/module_domain_truststore.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module "domain_truststore" {
2-
32
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-s3bucket.zip"
43

54
name = "truststore"

infrastructure/terraform/components/api/module_lambda_get_letters.tf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ module "get_letters" {
3535
log_destination_arn = local.destination_arn
3636
log_subscription_role_arn = local.acct.log_subscription_role_arn
3737

38-
lambda_env_vars = {
39-
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
40-
LETTER_TTL_HOURS = var.letter_table_ttl_hours,
41-
MAX_LIMIT = var.max_get_limit,
42-
}
38+
lambda_env_vars = merge(local.common_db_access_lambda_env_vars, {
39+
MAX_LIMIT = var.max_get_limit
40+
})
4341
}
4442

4543
data "aws_iam_policy_document" "get_letters_lambda" {

infrastructure/terraform/components/api/module_lambda_patch_letters.tf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ module "patch_letters" {
3535
log_destination_arn = local.destination_arn
3636
log_subscription_role_arn = local.acct.log_subscription_role_arn
3737

38-
lambda_env_vars = {
39-
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
40-
LETTER_TTL_HOURS = 24
41-
}
38+
lambda_env_vars = merge(local.common_db_access_lambda_env_vars, {})
4239
}
4340

4441
data "aws_iam_policy_document" "patch_letters_lambda" {

infrastructure/terraform/components/api/resources/spec.tmpl.json

Lines changed: 6 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -67,154 +67,29 @@
6767
],
6868
"patch": {
6969
"description": "Update the status of a letter by providing the new status in the request body.",
70+
"operationId": "patchLetters",
7071
"requestBody": {
71-
"content": {
72-
"application/vnd.api+json": {
73-
"schema": {
74-
"properties": {
75-
"data": {
76-
"properties": {
77-
"attributes": {
78-
"properties": {
79-
"reasonCode": {
80-
"description": "Reason code for the given status",
81-
"type": "number"
82-
},
83-
"reasonText": {
84-
"description": "Reason text for the given status",
85-
"type": "string"
86-
},
87-
"requestedProductionStatus": {
88-
"description": "The requested production status for this letter.\nMay only be set by NHS Notify.",
89-
"enum": [
90-
"ACTIVE",
91-
"HOLD",
92-
"CANCEL"
93-
],
94-
"title": "ProductionStatus",
95-
"type": "string"
96-
},
97-
"status": {
98-
"default": "PENDING",
99-
"description": "The supplier status of an individual letter",
100-
"enum": [
101-
"PENDING",
102-
"ACCEPTED",
103-
"REJECTED",
104-
"PRINTED",
105-
"ENCLOSED",
106-
"CANCELLED",
107-
"DISPATCHED",
108-
"FAILED",
109-
"RETURNED",
110-
"DESTROYED",
111-
"FORWARDED"
112-
],
113-
"type": "string"
114-
}
115-
},
116-
"type": "object"
117-
},
118-
"id": {
119-
"type": "string"
120-
},
121-
"type": {
122-
"const": "Letter",
123-
"type": "string"
124-
}
125-
},
126-
"type": "object"
127-
}
128-
},
129-
"type": "object"
130-
}
131-
}
132-
},
13372
"required": true
13473
},
13574
"responses": {
13675
"200": {
137-
"content": {
138-
"application/vnd.api+json": {
139-
"schema": {
140-
"properties": {
141-
"data": {
142-
"properties": {
143-
"attributes": {
144-
"properties": {
145-
"reasonCode": {
146-
"description": "Reason code for the given status",
147-
"type": "number"
148-
},
149-
"reasonText": {
150-
"description": "Reason text for the given status",
151-
"type": "string"
152-
},
153-
"requestedProductionStatus": {
154-
"description": "A requested status for the production of a letter",
155-
"enum": [
156-
"ACTIVE",
157-
"HOLD",
158-
"CANCEL"
159-
],
160-
"title": "ProductionStatus",
161-
"type": "string"
162-
},
163-
"status": {
164-
"default": "PENDING",
165-
"description": "The supplier status of an individual letter",
166-
"enum": [
167-
"PENDING",
168-
"ACCEPTED",
169-
"REJECTED",
170-
"PRINTED",
171-
"ENCLOSED",
172-
"CANCELLED",
173-
"DISPATCHED",
174-
"FAILED",
175-
"RETURNED",
176-
"DESTROYED",
177-
"FORWARDED"
178-
],
179-
"type": "string"
180-
}
181-
},
182-
"required": [
183-
"status",
184-
"requestedProductionStatus"
185-
],
186-
"type": "object"
187-
},
188-
"id": {
189-
"type": "string"
190-
},
191-
"type": {
192-
"const": "Letter",
193-
"type": "string"
194-
}
195-
},
196-
"type": "object"
197-
}
198-
},
199-
"type": "object"
200-
}
201-
}
202-
},
203-
"description": "Letter resource updated successfully"
76+
"description": "List of letters to process"
20477
},
20578
"400": {
206-
"description": "Bad request"
79+
"description": "Bad request, invalid input data"
20780
},
20881
"404": {
20982
"description": "Resource not found"
83+
},
84+
"500": {
85+
"description": "Server error"
21086
}
21187
},
21288
"security": [
21389
{
21490
"LambdaAuthorizer": []
21591
}
21692
],
217-
"summary": "Update the status of a letter",
21893
"x-amazon-apigateway-integration": {
21994
"contentHandling": "CONVERT_TO_TEXT",
22095
"credentials": "${APIG_EXECUTION_ROLE_ARN}",

0 commit comments

Comments
 (0)