Skip to content

Commit 3f3f3a3

Browse files
committed
fix post merge
1 parent d525da8 commit 3f3f3a3

File tree

5 files changed

+14
-126
lines changed

5 files changed

+14
-126
lines changed

infrastructure/terraform/modules/backend-api/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ No requirements.
3838
| Name | Source | Version |
3939
|------|--------|---------|
4040
| <a name="module_authorizer_lambda"></a> [authorizer\_lambda](#module\_authorizer\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
41+
| <a name="module_count_routing_configs_lambda"></a> [count\_routing\_configs\_lambda](#module\_count\_routing\_configs\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
4142
| <a name="module_create_routing_config_lambda"></a> [create\_routing\_config\_lambda](#module\_create\_routing\_config\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
4243
| <a name="module_create_template_lambda"></a> [create\_template\_lambda](#module\_create\_template\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
4344
| <a name="module_delete_template_lambda"></a> [delete\_template\_lambda](#module\_delete\_template\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
@@ -62,7 +63,9 @@ No requirements.
6263
| <a name="module_sqs_template_mgmt_events"></a> [sqs\_template\_mgmt\_events](#module\_sqs\_template\_mgmt\_events) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-sqs.zip | n/a |
6364
| <a name="module_sqs_template_table_events_pipe_dlq"></a> [sqs\_template\_table\_events\_pipe\_dlq](#module\_sqs\_template\_table\_events\_pipe\_dlq) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-sqs.zip | n/a |
6465
| <a name="module_sqs_validate_letter_template_files"></a> [sqs\_validate\_letter\_template\_files](#module\_sqs\_validate\_letter\_template\_files) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.20/terraform-sqs.zip | n/a |
66+
| <a name="module_submit_routing_config_lambda"></a> [submit\_routing\_config\_lambda](#module\_submit\_routing\_config\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
6567
| <a name="module_submit_template_lambda"></a> [submit\_template\_lambda](#module\_submit\_template\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
68+
| <a name="module_update_routing_config_lambda"></a> [update\_routing\_config\_lambda](#module\_update\_routing\_config\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
6669
| <a name="module_update_template_lambda"></a> [update\_template\_lambda](#module\_update\_template\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
6770
| <a name="module_upload_letter_template_lambda"></a> [upload\_letter\_template\_lambda](#module\_upload\_letter\_template\_lambda) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.22/terraform-lambda.zip | n/a |
6871
## Outputs

lambdas/backend-api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ curl -X PUT --location "${APIG_STAGE}/v1/routing-configuration/${ROUTING_CONFIG_
192192
}'
193193
```
194194
195-
### PATCH - /v1/template/:templateId/submit - Submit a routing config
195+
### PATCH - /v1/template/:templateId/submit - Submit a routing configuration
196196
197197
```bash
198198
curl -X PATCH --location "${APIG_STAGE}/v1/routing-configuration/${ROUTING_CONFIG_ID}/submit" \

lambdas/backend-api/src/__tests__/templates/infra/routing-config-repository/repository.test.ts

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -216,119 +216,4 @@ describe('RoutingConfigRepository', () => {
216216
});
217217
});
218218
});
219-
220-
describe('create', () => {
221-
const input: CreateUpdateRoutingConfig = {
222-
name: 'rc',
223-
campaignId: 'campaign',
224-
cascade: [
225-
{
226-
cascadeGroups: ['standard'],
227-
channel: 'SMS',
228-
channelType: 'primary',
229-
defaultTemplateId: 'sms',
230-
},
231-
],
232-
cascadeGroupOverrides: [{ name: 'standard' }],
233-
};
234-
235-
const rc: RoutingConfig = {
236-
...input,
237-
clientId: user.clientId,
238-
createdAt: date.toISOString(),
239-
id: generatedId,
240-
status: 'DRAFT',
241-
updatedAt: date.toISOString(),
242-
};
243-
244-
const putPayload = {
245-
...rc,
246-
owner: `CLIENT#${user.clientId}`,
247-
createdBY: user.userId,
248-
updatedBy: user.userId,
249-
};
250-
251-
test('should create routing config', async () => {
252-
const { repo, mocks } = setup();
253-
254-
mocks.dynamo
255-
.on(PutCommand, {
256-
TableName: TABLE_NAME,
257-
Item: putPayload,
258-
})
259-
.resolves({});
260-
261-
const result = await repo.create(input, user);
262-
263-
expect(result).toEqual({ data: rc });
264-
});
265-
266-
test('returns failure if put fails', async () => {
267-
const { repo, mocks } = setup();
268-
269-
const err = new Error('ddb_err');
270-
271-
mocks.dynamo.on(PutCommand).rejects(err);
272-
273-
const result = await repo.create(input, user);
274-
275-
expect(result).toEqual({
276-
error: {
277-
actualError: err,
278-
errorMeta: {
279-
code: 500,
280-
description: 'Failed to create routing config',
281-
},
282-
},
283-
});
284-
});
285-
286-
test('returns failure if constructed routing config is invalid', async () => {
287-
const { repo } = setup();
288-
289-
uuidMock.mockReturnValueOnce('not_a_uuid' as UUID);
290-
291-
const result = await repo.create(input, user);
292-
293-
expect(result).toEqual({
294-
error: {
295-
actualError: expect.objectContaining({
296-
issues: expect.arrayContaining([
297-
expect.objectContaining({
298-
path: ['id'],
299-
code: 'invalid_format',
300-
format: 'uuid',
301-
}),
302-
]),
303-
}),
304-
errorMeta: {
305-
code: 500,
306-
description: 'Failed to create routing config',
307-
},
308-
},
309-
});
310-
});
311-
312-
test('returns errors if the database call fails', async () => {
313-
const { repo, mocks } = setup();
314-
315-
const e = new Error('Oh No');
316-
317-
mocks.dynamo.on(GetCommand).rejectsOnce(e);
318-
319-
const result = await repo.get(
320-
'b9b6d56b-421e-462f-9ce5-3012e3fdb27f',
321-
'nhs-notify-client-id'
322-
);
323-
324-
expect(result.error).toMatchObject({
325-
actualError: e,
326-
errorMeta: expect.objectContaining({
327-
code: 500,
328-
}),
329-
});
330-
331-
expect(result.data).toBeUndefined();
332-
});
333-
});
334219
});

lambdas/backend-api/src/templates/app/routing-config-client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
$CreateUpdateRoutingConfig,
44
$ListRoutingConfigFilters,
55
ErrorCase,
6-
type CreateUpdateRoutingConfig,
76
type ListRoutingConfigFilters,
87
type Result,
98
type RoutingConfig,

lambdas/backend-api/src/templates/infra/routing-config-repository/repository.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,16 @@ export class RoutingConfigRepository {
146146
id: string,
147147
clientId: string
148148
): Promise<ApplicationResult<RoutingConfig>> {
149-
const result = await this.client.send(
150-
new GetCommand({
151-
TableName: this.tableName,
152-
Key: {
153-
id,
154-
owner: this.clientOwnerKey(clientId),
155-
},
156-
})
157-
);
149+
try {
150+
const result = await this.client.send(
151+
new GetCommand({
152+
TableName: this.tableName,
153+
Key: {
154+
id,
155+
owner: this.clientOwnerKey(clientId),
156+
},
157+
})
158+
);
158159

159160
if (!result.Item) {
160161
return failure(ErrorCase.NOT_FOUND, 'Routing Config not found');

0 commit comments

Comments
 (0)