Skip to content

Commit 39531ae

Browse files
committed
CCM-11343: add event pipe filter
1 parent 29aa2ea commit 39531ae

File tree

3 files changed

+35
-44
lines changed

3 files changed

+35
-44
lines changed

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -250,41 +250,6 @@ describe('PreviewLetterTemplate component', () => {
250250
expect(container.asFragment()).toMatchSnapshot();
251251
});
252252

253-
it('matches snapshot when template proofingEnabled false', () => {
254-
const container = render(
255-
<PreviewLetterTemplate
256-
template={{
257-
id: '0A097DCD-35F9-4DAD-A37E-AC358B71B74D',
258-
owner: 'owner',
259-
name: 'letter',
260-
templateType: 'LETTER',
261-
templateStatus: 'NOT_YET_SUBMITTED',
262-
letterType: 'x0',
263-
language: 'en',
264-
files: {
265-
pdfTemplate: {
266-
fileName: 'file.pdf',
267-
currentVersion: 'b',
268-
virusScanStatus: 'PASSED',
269-
},
270-
proofs: {
271-
'your-proof.pdf': {
272-
fileName: 'your-proof.pdf',
273-
virusScanStatus: 'PASSED',
274-
supplier: 'MBA',
275-
},
276-
},
277-
},
278-
proofingEnabled: false,
279-
createdAt: '2025-04-02T09:33:25.729Z',
280-
updatedAt: '2025-04-02T09:33:25.729Z',
281-
}}
282-
/>
283-
);
284-
285-
expect(container.asFragment()).toMatchSnapshot();
286-
});
287-
288253
it('matches snapshot when template language is Right to Left', () => {
289254
isRightToLeftMock.mockReset();
290255

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,7 @@ export function PreviewLetterTemplate({
6363
errors.push(validationError, validationErrorAction);
6464
}
6565

66-
let continueButton = buttonMap[template.templateStatus];
67-
68-
// TODO: this will prevent ALL current letter templates from
69-
// submitting a proof request - are we fine with this?
70-
// Or should we just let the requests fall over?
71-
// after a period of time we _could_ probably remove this check.
72-
if (!template.proofingEnabled) {
73-
continueButton = buttonMap['NOT_YET_SUBMITTED'];
74-
}
66+
const continueButton = buttonMap[template.templateStatus];
7567

7668
const footerText = footer[template.templateStatus] ?? [];
7769

infrastructure/terraform/modules/backend-api/pipes_pipe_template_table_events.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,40 @@ resource "aws_pipes_pipe" "template_table_events" {
1919
arn = module.sqs_template_table_events_pipe_dlq.sqs_queue_arn
2020
}
2121
}
22+
23+
filter_criteria {
24+
filter {
25+
pattern = jsonencode({
26+
"$or" = [
27+
{
28+
# Allow all non-LETTER templates
29+
dynamodb = {
30+
NewImage = {
31+
templateType = {
32+
S = [{ "anything-but" = "LETTER" }]
33+
}
34+
}
35+
}
36+
eventName = ["INSERT", "MODIFY"]
37+
},
38+
{
39+
# Allow LETTER templates only when proofingEnabled is true
40+
dynamodb = {
41+
NewImage = {
42+
templateType = {
43+
S = ["LETTER"]
44+
}
45+
proofingEnabled = {
46+
BOOL = [true]
47+
}
48+
}
49+
}
50+
eventName = ["INSERT", "MODIFY"]
51+
}
52+
]
53+
})
54+
}
55+
}
2256
}
2357

2458
target_parameters {

0 commit comments

Comments
 (0)