Skip to content

Commit 23ced98

Browse files
authored
Merge branch 'main' into feature/CCM-11459_edit-button
2 parents d1f3f85 + 0e59a23 commit 23ced98

File tree

32 files changed

+497
-135
lines changed

32 files changed

+497
-135
lines changed

infrastructure/terraform/modules/backend-api/spec.tmpl.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@
216216
},
217217
"proofingEnabled": {
218218
"type": "boolean"
219+
},
220+
"supplierReferences": {
221+
"additionalProperties": {
222+
"type": "string"
223+
},
224+
"type": "object"
219225
}
220226
},
221227
"required": [

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2108,6 +2108,7 @@ describe('templateRepository', () => {
21082108
'#templateType': 'templateType',
21092109
'#updatedAt': 'updatedAt',
21102110
'#proofingEnabled': 'proofingEnabled',
2111+
'#supplierReferences': 'supplierReferences',
21112112
},
21122113
ExpressionAttributeValues: {
21132114
':condition_1_templateStatus': 'PENDING_PROOF_REQUEST',
@@ -2116,13 +2117,14 @@ describe('templateRepository', () => {
21162117
':condition_5_proofingEnabled': true,
21172118
':templateStatus': 'WAITING_FOR_PROOF',
21182119
':updatedAt': '2024-12-27T00:00:00.000Z',
2120+
':supplierReferences': {},
21192121
},
21202122
Key: { id: 'template-id', owner: ownerWithClientPrefix },
21212123
ReturnValues: 'ALL_NEW',
21222124
ReturnValuesOnConditionCheckFailure: 'ALL_OLD',
21232125
TableName: 'templates',
21242126
UpdateExpression:
2125-
'SET #templateStatus = :templateStatus, #updatedAt = :updatedAt',
2127+
'SET #templateStatus = :templateStatus, #supplierReferences = if_not_exists(#supplierReferences, :supplierReferences), #updatedAt = :updatedAt',
21262128
});
21272129
});
21282130

lambdas/backend-api/src/templates/infra/template-repository.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const letterAttributes: Record<keyof LetterProperties, null> = {
6060
personalisationParameters: null,
6161
templateType: null,
6262
proofingEnabled: null,
63+
supplierReferences: null,
6364
};
6465

6566
export class TemplateRepository {
@@ -651,6 +652,11 @@ export class TemplateRepository {
651652
)
652653
.setStatus('WAITING_FOR_PROOF')
653654
.expectedStatus('PENDING_PROOF_REQUEST')
655+
656+
// dynamodb does not support conditional initialising of maps, so we have to
657+
// initialise an empty map here, then we set supplier-specific values in the
658+
// per-supplier sftp send lambda
659+
.initialiseSupplierReferences()
654660
.expectedTemplateType('LETTER')
655661
.expectedClientId(user.clientId)
656662
.expectTemplateExists()

lambdas/backend-client/src/types/generated/types.gen.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ export type LetterProperties = UploadLetterProperties & {
8080
files: LetterFiles;
8181
personalisationParameters?: Array<string>;
8282
proofingEnabled?: boolean;
83+
supplierReferences?: {
84+
[key: string]: string;
85+
};
8386
};
8487

8588
export type LetterType = 'q4' | 'x0' | 'x1';

lambdas/event-publisher/src/__tests__/domain/event-builder.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const expectedEvent = (status: string, type: string, dataschema: string) => ({
201201
type,
202202
specversion: '1.0',
203203
dataschema,
204-
dataschemaversion: '1.1.0',
204+
dataschemaversion: '1.1.1',
205205
plane: 'control',
206206
subject: '92b676e9-470f-4d04-ab14-965ef145e15d',
207207
data: {

0 commit comments

Comments
 (0)