Skip to content

Commit a93b823

Browse files
Merge remote-tracking branch 'origin/main' into feature/CCM-12097
2 parents f4dfe28 + 38c1fa6 commit a93b823

File tree

26 files changed

+101
-50
lines changed

26 files changed

+101
-50
lines changed

docs/assets/diagrams/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ erDiagram
1313
string status "enum: PENDING, ACCEPTED, REJECTED, PRINTED, ENCLOSED, CANCELLED, DISPATCHED, FAILED, RETURNED, FORWARDED, DELIVERED"
1414
string specificationId
1515
string groupId
16-
number reasonCode
16+
string reasonCode
1717
string reasonText
1818
string supplierId
1919
string url "url"

internal/datastore/src/__test__/letter-repository.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ describe('LetterRepository', () => {
111111
id: 'letter1',
112112
supplierId: 'supplier1',
113113
status: 'REJECTED',
114-
reasonCode: 1,
114+
reasonCode: 'R01',
115115
reasonText: 'Reason text'
116116
};
117117
await letterRepository.updateLetterStatus(letterDto);
118118

119119
const updatedLetter = await letterRepository.getLetterById('supplier1', 'letter1');
120120
expect(updatedLetter.status).toBe('REJECTED');
121-
expect(updatedLetter.reasonCode).toBe(1);
121+
expect(updatedLetter.reasonCode).toBe('R01');
122122
expect(updatedLetter.reasonText).toBe('Reason text');
123123
});
124124

internal/datastore/src/types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ erDiagram
1313
string status "enum: PENDING, ACCEPTED, REJECTED, PRINTED, ENCLOSED, CANCELLED, DISPATCHED, FAILED, RETURNED, FORWARDED, DELIVERED"
1414
string specificationId
1515
string groupId
16-
number reasonCode
16+
string reasonCode
1717
string reasonText
1818
string supplierId
1919
string url "url"

internal/datastore/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const LetterSchemaBase = z.object({
2424
status: LetterStatus,
2525
specificationId: z.string(),
2626
groupId: z.string(),
27-
reasonCode: z.number().optional(),
27+
reasonCode: z.string().optional(),
2828
reasonText: z.string().optional()
2929
});
3030

lambdas/api-handler/src/contracts/letters.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const LetterDtoSchema = z.object({
2121
supplierId: z.string(),
2222
specificationId: z.string().optional(),
2323
groupId: z.string().optional(),
24-
reasonCode: z.number().optional(),
24+
reasonCode: z.string().optional(),
2525
reasonText: z.string().optional(),
2626
}).strict();
2727

@@ -32,7 +32,7 @@ export const PatchLetterRequestResourceSchema = z.object({
3232
type: z.literal('Letter'),
3333
attributes: z.object({
3434
status: LetterStatusSchema,
35-
reasonCode: z.number().optional(),
35+
reasonCode: z.string().optional(),
3636
reasonText: z.string().optional(),
3737
}).strict()
3838
}).strict();
@@ -44,7 +44,7 @@ export const GetLetterResponseResourceSchema = z.object({
4444
status: LetterStatusSchema,
4545
specificationId: z.string(),
4646
groupId: z.string().optional(),
47-
reasonCode: z.number().optional(),
47+
reasonCode: z.string().optional(),
4848
reasonText: z.string().optional(),
4949
}).strict()
5050
}).strict();

lambdas/api-handler/src/handlers/__tests__/get-letter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('API Lambda handler', () => {
7878
specificationId: 'spec1',
7979
groupId: 'group1',
8080
status: 'FAILED',
81-
reasonCode: 100,
81+
reasonCode: 'R01',
8282
reasonText: 'failed validation'
8383
});
8484

@@ -97,7 +97,7 @@ describe('API Lambda handler', () => {
9797
status: 'FAILED',
9898
specificationId: 'spec1',
9999
groupId: 'group1',
100-
reasonCode: 100,
100+
reasonCode: 'R01',
101101
reasonText: 'failed validation'
102102
}
103103
}

lambdas/api-handler/src/handlers/__tests__/get-letters.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('API Lambda handler', () => {
6565
specificationId: 's1',
6666
groupId: 'g1',
6767
status: 'PENDING',
68-
reasonCode: 123, // shouldn't be returned if present
68+
reasonCode: 'R02', // shouldn't be returned if present
6969
reasonText: 'Reason text' // shouldn't be returned if present
7070
},
7171
]);

lambdas/api-handler/src/handlers/__tests__/patch-letter.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const updateLetterStatusRequest : PatchLetterRequest = {
3232
type: 'Letter',
3333
attributes: {
3434
status: 'REJECTED',
35-
reasonCode: 123,
35+
reasonCode: 'R01',
3636
reasonText: 'Reason text',
3737
}
3838
}
@@ -81,7 +81,7 @@ describe('patchLetter API Handler', () => {
8181
status: 'REJECTED',
8282
specificationId: 'spec1',
8383
groupId: 'group1',
84-
reasonCode: 123,
84+
reasonCode: 'R01',
8585
reasonText: 'Reason text',
8686
}
8787
}

lambdas/api-handler/src/mappers/__tests__/letter-mapper.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('letter-mapper', () => {
4646
supplierStatus: 'supplier1#PENDING',
4747
supplierStatusSk: Date.now().toString(),
4848
ttl: 123,
49-
reasonCode: 123,
49+
reasonCode: 'R01',
5050
reasonText: 'Reason text'
5151
};
5252

@@ -60,7 +60,7 @@ describe('letter-mapper', () => {
6060
specificationId: 'spec123',
6161
status: 'PENDING',
6262
groupId: 'group123',
63-
reasonCode: 123,
63+
reasonCode: 'R01',
6464
reasonText: 'Reason text',
6565
}
6666
}
@@ -111,7 +111,7 @@ describe('letter-mapper', () => {
111111
supplierStatus: 'supplier1#PENDING',
112112
supplierStatusSk: Date.now().toString(),
113113
ttl: 123,
114-
reasonCode: 123,
114+
reasonCode: 'R01',
115115
reasonText: 'Reason text'
116116
};
117117

@@ -125,7 +125,7 @@ describe('letter-mapper', () => {
125125
specificationId: 'spec123',
126126
status: 'PENDING',
127127
groupId: 'group123',
128-
reasonCode: 123,
128+
reasonCode: 'R01',
129129
reasonText: 'Reason text',
130130
}
131131
}
@@ -145,7 +145,7 @@ describe('letter-mapper', () => {
145145
supplierStatus: 'supplier1#PENDING',
146146
supplierStatusSk: Date.now().toString(),
147147
ttl: 123,
148-
reasonCode: 123,
148+
reasonCode: 'R01',
149149
reasonText: 'Reason text'
150150
};
151151

lambdas/api-handler/src/services/__tests__/letter-operations.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('patchLetterStatus function', () => {
103103
id: 'letter1',
104104
supplierId: 'supplier1',
105105
status: 'REJECTED',
106-
reasonCode: 123,
106+
reasonCode: 'R01',
107107
reasonText: 'Reason text'
108108
};
109109

@@ -224,7 +224,7 @@ function makeLetter(id: string, status: Letter['status']) : Letter {
224224
supplierStatus: `supplier1#${status}`,
225225
supplierStatusSk: Date.now().toString(),
226226
ttl: 123,
227-
reasonCode: 123,
227+
reasonCode: 'R01',
228228
reasonText: "Reason text"
229229
};
230230
}

0 commit comments

Comments
 (0)