Skip to content

Commit c1748ab

Browse files
committed
feat: added 'updatedAt' field to claimDraft
1 parent 4dd1d2b commit c1748ab

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

packages/claims-controller/src/ClaimsController.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ describe('ClaimsController', () => {
265265
impactedTxHash: '0x123',
266266
reimbursementWalletAddress: '0x456',
267267
description: 'test description',
268+
updatedAt: '2025-12-17T06:10:32.213Z',
268269
};
269270
const MOCK_CLAIM_DRAFTS: ClaimDraft[] = [
270271
{
@@ -275,6 +276,7 @@ describe('ClaimsController', () => {
275276
impactedTxHash: '0x123',
276277
reimbursementWalletAddress: '0x456',
277278
description: 'test description',
279+
updatedAt: '2025-12-17T06:10:32.213Z',
278280
},
279281
{
280282
draftId: 'mock-draft-2',
@@ -284,6 +286,7 @@ describe('ClaimsController', () => {
284286
impactedTxHash: '0x789',
285287
reimbursementWalletAddress: '0x012',
286288
description: 'test description 2',
289+
updatedAt: '2025-12-17T06:10:32.213Z',
287290
},
288291
];
289292

@@ -295,7 +298,10 @@ describe('ClaimsController', () => {
295298
expect(updatedState).not.toBe(initialState);
296299
expect(updatedState.drafts).toHaveLength(1);
297300
expect(updatedState.drafts[0].draftId).toBeDefined();
298-
expect(updatedState.drafts[0]).toMatchObject(MOCK_DRAFT);
301+
expect(updatedState.drafts[0]).toMatchObject({
302+
...MOCK_DRAFT,
303+
updatedAt: expect.any(String),
304+
});
299305
expect(updatedState.drafts[0].draftId).toBeDefined();
300306
});
301307
});

packages/claims-controller/src/ClaimsController.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ export class ClaimsController extends BaseController<
235235
this.update((state) => {
236236
state.drafts = state.drafts.map((existingDraft) =>
237237
existingDraft.draftId === draft.draftId
238-
? { ...existingDraft, ...draft }
238+
? {
239+
...existingDraft,
240+
...draft,
241+
updatedAt: new Date().toISOString(),
242+
}
239243
: existingDraft,
240244
);
241245
});
@@ -248,6 +252,7 @@ export class ClaimsController extends BaseController<
248252
const newDraft: ClaimDraft = {
249253
...draft,
250254
draftId,
255+
updatedAt: new Date().toISOString(),
251256
};
252257

253258
this.update((state) => {

packages/claims-controller/src/types.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,7 @@ export type Claim = {
5151
export type ClaimDraft = Partial<
5252
Omit<
5353
Claim,
54-
| 'id'
55-
| 'shortId'
56-
| 'createdAt'
57-
| 'updatedAt'
58-
| 'intercomId'
59-
| 'status'
60-
| 'attachments'
54+
'id' | 'shortId' | 'createdAt' | 'intercomId' | 'status' | 'attachments'
6155
>
6256
> & {
6357
/**

0 commit comments

Comments
 (0)