Skip to content

Commit 7eda0d2

Browse files
CCM-10283: Template submitted email (#534)
1 parent 1b35643 commit 7eda0d2

File tree

85 files changed

+1662
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1662
-141
lines changed

frontend/package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
{
2-
"name": "nhs-notify-web-template-management-frontend",
3-
"version": "0.1.0",
4-
"private": true,
5-
"scripts": {
6-
"dev": "next dev",
7-
"build": "next build",
8-
"start": "next start",
9-
"lint": "npm run mock-amplify-outputs && next lint --dir .",
10-
"lint:fix": "npm run lint -- --fix",
11-
"test:unit": "npm run mock-amplify-outputs && jest",
12-
"app:start": "pm2 start npm -- start",
13-
"app:wait": "wait-on -l http://localhost:3000/templates/create-and-submit-templates",
14-
"app:stop": "pm2 kill",
15-
"typecheck": "npm run mock-amplify-outputs && tsc --noEmit",
16-
"create-sandbox": "pm2 start npx -- ampx sandbox",
17-
"destroy-sandbox": "npx ampx sandbox delete --y",
18-
"mock-amplify-outputs": "if [ ! -f ./amplify_outputs.json ]; then echo \"{}\" > ./amplify_outputs.json ; fi"
19-
},
202
"dependencies": {
213
"@aws-amplify/adapter-nextjs": "^1.5.6",
224
"@aws-amplify/ui-react": "^6.9.4",
@@ -27,7 +9,6 @@
279
"jsonwebtoken": "^9.0.2",
2810
"jwt-decode": "^4.0.0",
2911
"markdown-it": "^13.0.2",
30-
"mimetext": "^3.0.27",
3112
"next": "^15.2.3",
3213
"next-client-cookies": "^2.0.1",
3314
"nhs-notify-backend-client": "^0.0.1",
@@ -67,5 +48,23 @@
6748
"typescript": "^5.8.2",
6849
"wait-on": "^8.0.3",
6950
"whatwg-fetch": "^3.6.20"
70-
}
51+
},
52+
"name": "nhs-notify-web-template-management-frontend",
53+
"private": true,
54+
"scripts": {
55+
"app:start": "pm2 start npm -- start",
56+
"app:stop": "pm2 kill",
57+
"app:wait": "wait-on -l http://localhost:3000/templates/create-and-submit-templates",
58+
"build": "next build",
59+
"create-sandbox": "pm2 start npx -- ampx sandbox",
60+
"destroy-sandbox": "npx ampx sandbox delete --y",
61+
"dev": "next dev",
62+
"lint": "npm run mock-amplify-outputs && next lint --dir .",
63+
"lint:fix": "npm run lint -- --fix",
64+
"mock-amplify-outputs": "if [ ! -f ./amplify_outputs.json ]; then echo \"{}\" > ./amplify_outputs.json ; fi",
65+
"start": "next start",
66+
"test:unit": "npm run mock-amplify-outputs && jest",
67+
"typecheck": "npm run mock-amplify-outputs && tsc --noEmit"
68+
},
69+
"version": "0.1.0"
7170
}

frontend/src/__tests__/components/molecules/PreviewTemplateDetails.test.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,21 @@ describe('PreviewTemplateDetailsLetter', () => {
149149
virusScanStatus: 'PASSED',
150150
},
151151
proofs: {
152-
'a.pdf': { fileName: 'a.pdf', virusScanStatus: 'PASSED' },
153-
'b.pdf': { fileName: 'b.pdf', virusScanStatus: 'PASSED' },
154-
'c.pdf': { fileName: 'c.pdf', virusScanStatus: 'FAILED' },
152+
'a.pdf': {
153+
fileName: 'a.pdf',
154+
virusScanStatus: 'PASSED',
155+
supplier: 'MBA',
156+
},
157+
'b.pdf': {
158+
fileName: 'b.pdf',
159+
virusScanStatus: 'PASSED',
160+
supplier: 'MBA',
161+
},
162+
'c.pdf': {
163+
fileName: 'c.pdf',
164+
virusScanStatus: 'FAILED',
165+
supplier: 'MBA',
166+
},
155167
},
156168
},
157169
createdAt: '2025-01-13T10:19:25.579Z',

frontend/src/__tests__/components/molecules/ViewLetterTemplate.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('ViewLetterTemplate component', () => {
2626
'supplier-proof.pdf': {
2727
fileName: 'supplier-proof.pdf',
2828
virusScanStatus: 'PASSED',
29+
supplier: 'MBA',
2930
},
3031
},
3132
},

frontend/src/__tests__/components/organisms/PreviewLetterTemplate.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ describe('PreviewLetterTemplate component', () => {
101101
'your-proof.pdf': {
102102
fileName: 'your-proof.pdf',
103103
virusScanStatus: 'PASSED',
104+
supplier: 'MBA',
104105
},
105106
},
106107
},
@@ -133,6 +134,7 @@ describe('PreviewLetterTemplate component', () => {
133134
'your-proof.pdf': {
134135
fileName: 'your-proof.pdf',
135136
virusScanStatus: 'PASSED',
137+
supplier: 'MBA',
136138
},
137139
},
138140
},

frontend/src/middleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ export const config = {
133133
* - _next/image (image optimization files)
134134
* - favicon.ico (favicon file)
135135
* - lib/ (our static content)
136+
* - test files
136137
*/
137-
'/((?!_next/static|_next/image|favicon.ico|lib/).*)',
138+
'/((?!_next/static|_next/image|favicon.ico|lib/|testing).*)',
138139
],
139140
};

infrastructure/terraform/components/acct/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
| <a name="module_s3bucket_artefacts_us_east_1"></a> [s3bucket\_artefacts\_us\_east\_1](#module\_s3bucket\_artefacts\_us\_east\_1) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.2 |
4444
| <a name="module_s3bucket_backup_reports"></a> [s3bucket\_backup\_reports](#module\_s3bucket\_backup\_reports) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v1.0.8 |
4545
| <a name="module_s3bucket_data_migration_backups"></a> [s3bucket\_data\_migration\_backups](#module\_s3bucket\_data\_migration\_backups) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/s3bucket | v2.0.4 |
46+
| <a name="module_sandbox_ses"></a> [sandbox\_ses](#module\_sandbox\_ses) | ../../modules/ses | n/a |
47+
| <a name="module_ses_testing"></a> [ses\_testing](#module\_ses\_testing) | ../../modules/acct-ses-testing | n/a |
4648
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 5.19.0 |
4749
## Outputs
4850

@@ -52,6 +54,7 @@
5254
| <a name="output_github_pat_ssm_param_name"></a> [github\_pat\_ssm\_param\_name](#output\_github\_pat\_ssm\_param\_name) | n/a |
5355
| <a name="output_log_subscription_role_arn"></a> [log\_subscription\_role\_arn](#output\_log\_subscription\_role\_arn) | n/a |
5456
| <a name="output_s3_buckets"></a> [s3\_buckets](#output\_s3\_buckets) | n/a |
57+
| <a name="output_ses_testing_config"></a> [ses\_testing\_config](#output\_ses\_testing\_config) | n/a |
5558
| <a name="output_vpc_nat_ips"></a> [vpc\_nat\_ips](#output\_vpc\_nat\_ips) | n/a |
5659
| <a name="output_vpc_subnets"></a> [vpc\_subnets](#output\_vpc\_subnets) | n/a |
5760
<!-- vale on -->

infrastructure/terraform/components/acct/module_sandbox_kms.tf

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,56 @@ data "aws_iam_policy_document" "kms" {
5555
}
5656
}
5757

58+
statement {
59+
sid = "AllowS3"
60+
effect = "Allow"
61+
62+
principals {
63+
type = "Service"
64+
65+
identifiers = [
66+
"s3.amazonaws.com",
67+
]
68+
}
69+
70+
actions = [
71+
"kms:Encrypt*",
72+
"kms:Decrypt*",
73+
"kms:ReEncrypt*",
74+
"kms:GenerateDataKey*",
75+
"kms:Describe*"
76+
]
77+
78+
resources = [
79+
"*",
80+
]
81+
}
82+
83+
statement {
84+
sid = "AllowSES"
85+
effect = "Allow"
86+
87+
principals {
88+
type = "Service"
89+
90+
identifiers = [
91+
"ses.amazonaws.com",
92+
]
93+
}
94+
95+
actions = [
96+
"kms:Encrypt*",
97+
"kms:Decrypt*",
98+
"kms:ReEncrypt*",
99+
"kms:GenerateDataKey*",
100+
"kms:Describe*"
101+
]
102+
103+
resources = [
104+
"*",
105+
]
106+
}
107+
58108
statement {
59109
sid = "AllowLogDeliveryEncrypt"
60110
effect = "Allow"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module "sandbox_ses" {
2+
source = "../../modules/ses"
3+
4+
count = var.support_sandbox_environments ? 1 : 0
5+
6+
aws_account_id = var.aws_account_id
7+
region = var.region
8+
project = var.project
9+
environment = var.environment
10+
component = var.component
11+
12+
root_domain_name = "sandbox.${aws_route53_zone.main.name}"
13+
14+
zone_id = aws_route53_zone.main.id
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module "ses_testing" {
2+
count = local.use_sftp_letter_supplier_mock ? 1 : 0
3+
4+
source = "../../modules/acct-ses-testing"
5+
6+
project = var.project
7+
component = var.component
8+
aws_account_id = var.aws_account_id
9+
environment = var.environment
10+
group = var.group
11+
region = var.region
12+
13+
zone_id = aws_route53_zone.main.id
14+
root_domain_name = "sandbox.${aws_route53_zone.main.name}"
15+
16+
kms_key_arn = module.kms_sandbox.0.key_arn
17+
}

infrastructure/terraform/components/acct/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,11 @@ output "vpc_nat_ips" {
4949
output "log_subscription_role_arn" {
5050
value = module.obs_datasource.log_subscription_role_arn
5151
}
52+
53+
output "ses_testing_config" {
54+
value = try({
55+
bucket_name = module.ses_testing.0.bucket_name
56+
iam_role_arn = module.ses_testing.0.iam_role_arn
57+
rule_set_name = module.ses_testing.0.rule_set_name
58+
}, null)
59+
}

0 commit comments

Comments
 (0)