Skip to content

Commit b98c53b

Browse files
authored
Merge pull request #477 from NHSDigital/release/2025-01-24
Release/2025 01 24
2 parents d755dab + 8a533a4 commit b98c53b

File tree

130 files changed

+2252
-565
lines changed

Some content is hidden

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

130 files changed

+2252
-565
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repos:
44
rev: v1.4.0
55
hooks:
66
- id: detect-secrets
7-
exclude: ".pre-commit-config.yaml|infrastructure/localstack/provider.tf|src/etl/sds/tests/changelog|src/etl/sds/worker/bulk/transform_bulk/tests|src/etl/sds/worker/bulk/tests/stage_data"
7+
exclude: ".pre-commit-config.yaml|infrastructure/localstack/provider.tf|src/etl/sds/tests/changelog|src/etl/sds/worker/bulk/transform_bulk/tests|src/etl/sds/worker/bulk/tests/stage_data|src/api/tests/smoke_tests/test_smoke.py"
88

99
- repo: https://github.com/prettier/pre-commit
1010
rev: 57f39166b5a5a504d6808b87ab98d41ebf095b46

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2025-01-24
4+
- [PI-744] Create a Product Team (ProductID)
5+
- Dependabot: pydantic
6+
37
## 2025-01-22
48
- [PI-693] Changelog ETL - modify / remove from an AS
59

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2025.01.22
1+
2025.01.24

changelog/2025-01-24.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [PI-744] Create a Product Team (ProductID)
2+
- Dependabot: pydantic

infrastructure/swagger/05_paths.yaml

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ paths:
4040
$ref: "#/components/requestBodies/ProductTeamCreateRequestBody"
4141
responses:
4242
"201":
43-
$ref: "#/components/responses/ProductTeamCreate"
43+
$ref: "#/components/responses/CPMProductTeamCreate"
4444
"400":
4545
$ref: "#/components/responses/BadRequest"
4646
"422":
@@ -67,7 +67,7 @@ paths:
6767
- $ref: "#/components/parameters/HeaderCorrelationId"
6868
responses:
6969
"200":
70-
$ref: "#/components/responses/ProductTeamRead"
70+
$ref: "#/components/responses/CPMProductTeamRead"
7171
"404":
7272
$ref: "#/components/responses/NotFound"
7373
x-amazon-apigateway-integration:
@@ -77,7 +77,52 @@ paths:
7777
- ${authoriser_name}: []
7878
- app-level0: []
7979

80-
/ProductTeam/{product_team_id}/Product:
80+
/ProductTeamEpr:
81+
post:
82+
operationId: createproductteamepr
83+
summary: Create a Product Team (Epr) resource (POST)
84+
requestBody:
85+
$ref: "#/components/requestBodies/ProductTeamCreateRequestBody"
86+
responses:
87+
"201":
88+
$ref: "#/components/responses/EPRProductTeamCreate"
89+
"400":
90+
$ref: "#/components/responses/BadRequest"
91+
"422":
92+
$ref: "#/components/responses/UnprocessableContent"
93+
parameters:
94+
- $ref: "#/components/parameters/HeaderVersion"
95+
- $ref: "#/components/parameters/HeaderRequestId"
96+
- $ref: "#/components/parameters/HeaderCorrelationId"
97+
x-amazon-apigateway-integration:
98+
<<: *ApiGatewayIntegration
99+
uri: ${method_createProductTeamEpr}
100+
security:
101+
- ${authoriser_name}: []
102+
- app-level0: []
103+
104+
/ProductTeamEpr/{product_team_id}:
105+
get:
106+
operationId: readproductteamepr
107+
summary: Read a Product Team (Epr) resource (GET)
108+
parameters:
109+
- $ref: "#/components/parameters/ProductTeamId"
110+
- $ref: "#/components/parameters/HeaderVersion"
111+
- $ref: "#/components/parameters/HeaderRequestId"
112+
- $ref: "#/components/parameters/HeaderCorrelationId"
113+
responses:
114+
"200":
115+
$ref: "#/components/responses/EPRProductTeamRead"
116+
"404":
117+
$ref: "#/components/responses/NotFound"
118+
x-amazon-apigateway-integration:
119+
<<: *ApiGatewayIntegration
120+
uri: ${method_readProductTeamEpr}
121+
security:
122+
- ${authoriser_name}: []
123+
- app-level0: []
124+
125+
/ProductTeamEpr/{product_team_id}/Product:
81126
post:
82127
operationId: createproductendpoint
83128
summary: Create a Product resource (POST)
@@ -125,7 +170,7 @@ paths:
125170
- ${authoriser_name}: []
126171
- app-level0: []
127172

128-
/ProductTeam/{product_team_id}/Product/{product_id}:
173+
/ProductTeamEpr/{product_team_id}/Product/{product_id}:
129174
get:
130175
operationId: readproductendpoint
131176
summary: Read a Product resource (GET)
@@ -167,7 +212,7 @@ paths:
167212
- ${authoriser_name}: []
168213
- app-level0: []
169214

170-
/ProductTeam/{product_team_id}/Product/Epr:
215+
/ProductTeamEpr/{product_team_id}/Product/Epr:
171216
post:
172217
operationId: createproductforeprendpoint
173218
summary: Create an EPR Product resource (POST)
@@ -196,7 +241,7 @@ paths:
196241
- ${authoriser_name}: []
197242
- app-level0: []
198243

199-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData
244+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData
200245
: get:
201246
operationId: searchDeviceReferenceData
202247
summary: Retrieve all Data Reference Data resources associated with a Product (GET)
@@ -245,7 +290,7 @@ paths:
245290
- ${authoriser_name}: []
246291
- app-level0: []
247292

248-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/MhsMessageSet
293+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/MhsMessageSet
249294
: post:
250295
operationId: createDeviceReferenceDataMessageSet
251296
summary: Create a Device Reference Data Message Set resource (POST)
@@ -278,7 +323,7 @@ paths:
278323
- ${authoriser_name}: []
279324
- app-level0: []
280325

281-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/AccreditedSystemsAdditionalInteractions
326+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/AccreditedSystemsAdditionalInteractions
282327
: post:
283328
operationId: createDeviceReferenceDataAdditionalInteractions
284329
summary: Create a Device Reference Data Additional Interactions resource (POST)
@@ -311,7 +356,7 @@ paths:
311356
- ${authoriser_name}: []
312357
- app-level0: []
313358

314-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/{device_reference_data_id}
359+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/DeviceReferenceData/{device_reference_data_id}
315360
: get:
316361
operationId: readDeviceReferenceData
317362
summary: Read a Device Reference Data resource (GET)
@@ -335,7 +380,7 @@ paths:
335380
- ${authoriser_name}: []
336381
- app-level0: []
337382

338-
/ProductTeam/{product_team_id}/Product/{product_id}/{environment}/Device:
383+
/ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/Device:
339384
post:
340385
operationId: createDevice
341386
summary: Create a Device resource (POST)
@@ -364,7 +409,7 @@ paths:
364409
- ${authoriser_name}: []
365410
- app-level0: []
366411

367-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/Device/{device_id}
412+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/Device/{device_id}
368413
: get:
369414
operationId: readDevice
370415
summary: Read a Device resource (GET)
@@ -388,7 +433,7 @@ paths:
388433
- ${authoriser_name}: []
389434
- app-level0: []
390435

391-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/Device/MessageHandlingSystem
436+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/Device/MessageHandlingSystem
392437
: post:
393438
operationId: createDeviceMessageHandlingSystem
394439
summary: Create a Message Handling System Device resource (POST)
@@ -423,7 +468,7 @@ paths:
423468
- ${authoriser_name}: []
424469
- app-level0: []
425470

426-
? /ProductTeam/{product_team_id}/Product/{product_id}/{environment}/Device/AccreditedSystem
471+
? /ProductTeamEpr/{product_team_id}/Product/{product_id}/{environment}/Device/AccreditedSystem
427472
: post:
428473
operationId: createDeviceAccreditedSystem
429474
summary: Create a Accredited System Device resource (POST)

infrastructure/swagger/07_components--schemas--domain.yaml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ components:
2323
example:
2424
code: "OK"
2525
message: "Transaction successful"
26-
ProductTeamResponse:
26+
CPMProductTeamResponse:
2727
type: object
2828
properties:
2929
id:
@@ -52,7 +52,46 @@ components:
5252
key_value:
5353
type: string
5454
example:
55-
id: "F5H1R"
55+
id: "a9a9694d-001b-45ce-9f2a-6c9bf80ae0d0"
56+
name: "Sample Product Team"
57+
ods_code: "F5H1R"
58+
status: "active"
59+
created_on: "2024-10-15T10:00:00Z"
60+
updated_on: "2024-10-15T10:00:00Z"
61+
deleted_on: "null"
62+
keys:
63+
- key_type: "product_team_id_alias"
64+
key_value: "FOOBAR"
65+
EPRProductTeamResponse:
66+
type: object
67+
properties:
68+
id:
69+
type: string
70+
name:
71+
type: string
72+
ods_code:
73+
type: string
74+
status:
75+
type: string
76+
created_on:
77+
type: string
78+
updated_on:
79+
type: string
80+
nullable: true
81+
deleted_on:
82+
type: string
83+
nullable: true
84+
keys:
85+
type: array
86+
items:
87+
type: object
88+
properties:
89+
key_type:
90+
type: string
91+
key_value:
92+
type: string
93+
example:
94+
id: "F5H1R.a9a9694d-001b-45ce-9f2a-6c9bf80ae0d0"
5695
name: "Sample Product Team"
5796
ods_code: "F5H1R"
5897
status: "active"

infrastructure/swagger/12_components--responses.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,30 @@ components:
103103
errors:
104104
- code: "UNPROCESSABLE_ENTITY"
105105
message: "Invalid ODS Code: could not resolve 'https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/invalid_ods_code'"
106-
ProductTeamCreate:
106+
CPMProductTeamCreate:
107107
description: Create ProductTeam operation successful
108108
content:
109109
application/json:
110110
schema:
111-
$ref: "#/components/schemas/ProductTeamResponse"
112-
ProductTeamRead:
111+
$ref: "#/components/schemas/CPMProductTeamResponse"
112+
EPRProductTeamCreate:
113+
description: Create EPR ProductTeam operation successful
114+
content:
115+
application/json:
116+
schema:
117+
$ref: "#/components/schemas/EPRProductTeamResponse"
118+
CPMProductTeamRead:
113119
description: Read ProductTeam operation successful
114120
content:
115121
application/json:
116122
schema:
117-
$ref: "#/components/schemas/ProductTeamResponse"
123+
$ref: "#/components/schemas/CPMProductTeamResponse"
124+
EPRProductTeamRead:
125+
description: Read EPR ProductTeam operation successful
126+
content:
127+
application/json:
128+
schema:
129+
$ref: "#/components/schemas/EPRProductTeamResponse"
118130
ProductSearch:
119131
description: Search Product operation successful
120132
content:

infrastructure/terraform/per_workspace/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
workspace_type = var.workspace_type
66
permission_resource_map = {
77
kms = ["*"]
8-
dynamodb = ["${module.table.dynamodb_table_arn}", "${module.table.dynamodb_table_arn}/*"]
8+
dynamodb = ["${module.eprtable.dynamodb_table_arn}", "${module.eprtable.dynamodb_table_arn}/*", "${module.cpmtable.dynamodb_table_arn}", "${module.cpmtable.dynamodb_table_arn}/*"]
99
}
1010
# e.g. api.cpm.dev.national.nhs.uk
1111
zone = var.domain

infrastructure/terraform/per_workspace/main.tf

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,35 @@ data "aws_secretsmanager_secret" "cpm_apigee_api_key" {
3131
name = "${var.environment}-apigee-cpm-apikey"
3232
}
3333

34-
module "table" {
34+
module "eprtable" {
3535
source = "./modules/api_storage"
36-
name = "${local.project}--${replace(terraform.workspace, "_", "-")}--table"
36+
name = "${local.project}--${replace(terraform.workspace, "_", "-")}--epr-table"
37+
environment = var.environment
38+
deletion_protection_enabled = var.deletion_protection_enabled
39+
kms_deletion_window_in_days = 7
40+
range_key = "sk"
41+
hash_key = "pk"
42+
43+
attributes = [
44+
{ name = "pk", type = "S" },
45+
{ name = "sk", type = "S" },
46+
{ name = "pk_read", type = "S" },
47+
{ name = "sk_read", type = "S" },
48+
]
49+
50+
global_secondary_indexes = [
51+
{
52+
name = "idx_gsi_read"
53+
hash_key = "pk_read"
54+
range_key = "sk_read"
55+
projection_type = "ALL"
56+
}
57+
]
58+
}
59+
60+
module "cpmtable" {
61+
source = "./modules/api_storage"
62+
name = "${local.project}--${replace(terraform.workspace, "_", "-")}--cpm-table"
3763
environment = var.environment
3864
deletion_protection_enabled = var.deletion_protection_enabled
3965
kms_deletion_window_in_days = 7
@@ -95,7 +121,7 @@ module "lambdas" {
95121
}
96122
}
97123
environment_variables = {
98-
DYNAMODB_TABLE = module.table.dynamodb_table_name
124+
DYNAMODB_TABLE = contains(["createProductTeam", "readProductTeam"], each.key) ? module.cpmtable.dynamodb_table_name : module.eprtable.dynamodb_table_name
99125
}
100126
attach_policy_statements = length((fileset("${path.module}/../../../src/api/${each.key}/policies", "*.json"))) > 0
101127
policy_statements = {
@@ -182,8 +208,8 @@ module "sds_etl" {
182208
third_party_sds_update_layer_arn = element([for instance in module.third_party_layers : instance if instance.name == "third_party_sds_update"], 0).layer_arn
183209
domain_layer_arn = element([for instance in module.layers : instance if instance.name == "domain"], 0).layer_arn
184210
sds_layer_arn = element([for instance in module.layers : instance if instance.name == "sds"], 0).layer_arn
185-
table_name = module.table.dynamodb_table_name
186-
table_arn = module.table.dynamodb_table_arn
211+
table_name = module.eprtable.dynamodb_table_name
212+
table_arn = module.eprtable.dynamodb_table_arn
187213
is_persistent = var.workspace_type == "PERSISTENT"
188214
truststore_bucket = data.aws_s3_bucket.truststore_bucket
189215
etl_snapshot_bucket = local.etl_snapshot_bucket

infrastructure/terraform/per_workspace/outputs.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
output "dynamodb_table_name" {
2-
value = module.table.dynamodb_table_name
1+
output "dynamodb_epr_table_name" {
2+
value = module.eprtable.dynamodb_table_name
3+
}
4+
5+
output "dynamodb_cpm_table_name" {
6+
value = module.cpmtable.dynamodb_table_name
37
}
48

59
output "workspace" {

0 commit comments

Comments
 (0)