Skip to content

Commit fe3793f

Browse files
CCM-12090: Fix dependency check and typecheck
1 parent a9e97a0 commit fe3793f

File tree

7 files changed

+71
-65
lines changed

7 files changed

+71
-65
lines changed

lambdas/backend-api/src/__tests__/templates/api/upload-letter.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('upload-letter', () => {
3232
name: 'template-name',
3333
letterType: 'x0',
3434
language: 'en',
35+
campaignId: 'campaign-id'
3536
};
3637

3738
const pdf = Buffer.from('letterPdf');

lambdas/backend-api/src/__tests__/templates/app/template-client.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ describe('templateClient', () => {
168168
name: 'name',
169169
letterType: 'x0',
170170
language: 'en',
171+
campaignId: 'campaign-id',
171172
};
172173

173174
const result = await templateClient.createTemplate(data, user);
@@ -1259,6 +1260,7 @@ describe('templateClient', () => {
12591260
templateType: 'LETTER',
12601261
language: 'it',
12611262
letterType: 'x1',
1263+
campaignId: 'campaign-id',
12621264
};
12631265

12641266
const result = await templateClient.updateTemplate(

lambdas/backend-api/src/__tests__/templates/infra/get-letter-upload-parts.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ describe('getLetterUploadParts', () => {
88
name: 'template-name',
99
letterType: 'x0',
1010
language: 'en',
11+
campaignId: 'camapign-id',
1112
};
1213

1314
const pdf = Buffer.from('letterPdf');

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ const smsAttributes: Record<keyof SmsProperties, null> = {
5353
message: null,
5454
};
5555

56-
const letterAttributes: Record<keyof LetterProperties, null> = {
56+
const letterAttributes: Record<keyof UploadLetterProperties, null> = {
5757
files: null,
5858
language: null,
5959
letterType: null,
60-
personalisationParameters: null,
6160
templateType: null,
62-
proofingEnabled: null,
61+
campaignId: null,
6362
};
6463

6564
export class TemplateRepository {
@@ -818,7 +817,7 @@ export class TemplateRepository {
818817
}
819818
if (template.templateType === 'LETTER') {
820819
expressions.push(
821-
...this.attributeExpressionsFromMap<LetterProperties>(letterAttributes)
820+
...this.attributeExpressionsFromMap<UploadLetterProperties>(letterAttributes)
822821
);
823822
}
824823
return expressions;
@@ -849,7 +848,7 @@ export class TemplateRepository {
849848
names = this.attributeNamesFromMap<SmsProperties>(smsAttributes);
850849
}
851850
if (template.templateType === 'LETTER') {
852-
names = this.attributeNamesFromMap<LetterProperties>(letterAttributes);
851+
names = this.attributeNamesFromMap<UploadLetterProperties>(letterAttributes);
853852
}
854853

855854
return names;

lambdas/backend-client/src/__tests__/schemas/template-schema.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ describe('Template schemas', () => {
169169
letterType: 'x1',
170170
language: 'ar',
171171
name: 'letter',
172+
campaignId: 'campaign-id',
172173
};
173174

174175
const result = $CreateUpdateNonLetter.safeParse(letter);

lambdas/backend-client/src/__tests__/template-api-client.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ describe('TemplateAPIClient', () => {
9595
templateType: 'LETTER',
9696
language: 'de',
9797
letterType: 'x1',
98+
campaignId: 'campaign-id',
9899
},
99100
testToken,
100101
new File(['pdf'], 'template.pdf', { type: 'application/pdf' })
@@ -147,6 +148,7 @@ describe('TemplateAPIClient', () => {
147148
templateType: 'LETTER',
148149
language: 'de',
149150
letterType: 'x1',
151+
campaignId: 'campaign-id',
150152
},
151153
testToken,
152154
new File(['pdf'], 'template.pdf', { type: 'application/pdf' }),

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

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,31 @@ export type BaseCreatedTemplate = BaseTemplate & {
1111
updatedBy?: string;
1212
};
1313

14+
export type BaseLetterTemplateProperties = {
15+
files?: LetterFiles;
16+
language: Language;
17+
letterType: LetterType;
18+
templateType: 'LETTER';
19+
};
20+
1421
export type BaseTemplate = {
1522
name: string;
1623
};
1724

18-
export type UploadLetterProperties = BaseLetterTemplateProperties & {
19-
campaignId: string;
25+
export type ClientConfiguration = {
26+
campaignId?: string;
27+
campaignIds?: Array<string>;
28+
features: ClientFeatures;
2029
};
2130

22-
export type BaseLetterTemplateProperties = {
23-
files?: LetterFiles;
24-
language: Language;
25-
letterType: LetterType;
26-
templateType: 'LETTER';
31+
export type ClientConfigurationSuccess = {
32+
clientConfiguration: ClientConfiguration;
33+
statusCode: number;
34+
};
35+
36+
export type ClientFeatures = {
37+
proofing?: boolean;
38+
routing?: boolean;
2739
};
2840

2941
export type CreateUpdateTemplate = BaseTemplate &
@@ -104,32 +116,6 @@ export type SmsProperties = {
104116
templateType: 'SMS';
105117
};
106118

107-
export type TemplateSuccess = {
108-
statusCode: number;
109-
template: TemplateDto;
110-
};
111-
112-
export type ClientFeatures = {
113-
proofing?: boolean;
114-
routing?: boolean;
115-
};
116-
117-
export type ClientConfiguration = {
118-
campaignId?: string;
119-
campaignIds?: Array<string>;
120-
features: ClientFeatures;
121-
};
122-
123-
export type ClientConfigurationSuccess = {
124-
statusCode: number;
125-
clientConfiguration: ClientConfiguration;
126-
};
127-
128-
export type TemplateSuccessList = {
129-
statusCode: number;
130-
templates: Array<TemplateDto>;
131-
};
132-
133119
export type TemplateDto = BaseCreatedTemplate &
134120
(SmsProperties | EmailProperties | NhsAppProperties | LetterProperties);
135121

@@ -145,8 +131,22 @@ export type TemplateStatus =
145131
| 'WAITING_FOR_PROOF'
146132
| 'PROOF_AVAILABLE';
147133

134+
export type TemplateSuccess = {
135+
statusCode: number;
136+
template: TemplateDto;
137+
};
138+
139+
export type TemplateSuccessList = {
140+
statusCode: number;
141+
templates: Array<TemplateDto>;
142+
};
143+
148144
export type TemplateType = 'NHS_APP' | 'EMAIL' | 'SMS' | 'LETTER';
149145

146+
export type UploadLetterProperties = BaseLetterTemplateProperties & {
147+
campaignId: string;
148+
};
149+
150150
export type VersionedFileDetails = {
151151
currentVersion: string;
152152
fileName: string;
@@ -155,6 +155,33 @@ export type VersionedFileDetails = {
155155

156156
export type VirusScanStatus = 'PENDING' | 'FAILED' | 'PASSED';
157157

158+
export type GetV1ClientConfigurationData = {
159+
body?: never;
160+
path?: never;
161+
query?: never;
162+
url: '/v1/client-configuration';
163+
};
164+
165+
export type GetV1ClientConfigurationErrors = {
166+
/**
167+
* Error
168+
*/
169+
default: Failure;
170+
};
171+
172+
export type GetV1ClientConfigurationError =
173+
GetV1ClientConfigurationErrors[keyof GetV1ClientConfigurationErrors];
174+
175+
export type GetV1ClientConfigurationResponses = {
176+
/**
177+
* 200 response
178+
*/
179+
200: ClientConfigurationSuccess;
180+
};
181+
182+
export type GetV1ClientConfigurationResponse =
183+
GetV1ClientConfigurationResponses[keyof GetV1ClientConfigurationResponses];
184+
158185
export type PostV1LetterTemplateData = {
159186
/**
160187
* Letter template to create
@@ -405,33 +432,6 @@ export type GetV1TemplatesResponses = {
405432
export type GetV1TemplatesResponse =
406433
GetV1TemplatesResponses[keyof GetV1TemplatesResponses];
407434

408-
export type GetV1ClientConfigurationData = {
409-
body?: never;
410-
path?: never;
411-
query?: never;
412-
url: '/v1/client-configuration';
413-
};
414-
415-
export type GetV1ClientConfigurationErrors = {
416-
/**
417-
* Error
418-
*/
419-
default: Failure;
420-
};
421-
422-
export type GetV1ClientConfigurationError =
423-
GetV1ClientConfigurationErrors[keyof GetV1ClientConfigurationErrors];
424-
425-
export type GetV1ClientConfigurationResponses = {
426-
/**
427-
* 200 response
428-
*/
429-
200: ClientConfigurationSuccess;
430-
};
431-
432-
export type GetV1ClientConfigurationResponse =
433-
GetV1ClientConfigurationResponses[keyof GetV1ClientConfigurationResponses];
434-
435435
export type ClientOptions = {
436436
baseUrl: `${string}://${string}` | (string & {});
437437
};

0 commit comments

Comments
 (0)