Skip to content

Commit 1e003e0

Browse files
authored
[Reputation Oracle][Recording Oracle] Change event type task_completed to job_completed (#2564)
* Need to change event type task_completed to job_completed * Fix tests
1 parent 463f374 commit 1e003e0

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export enum EventType {
22
ESCROW_COMPLETED = 'escrow_completed',
3-
TASK_COMPLETED = 'task_completed',
3+
JOB_COMPLETED = 'job_completed',
44
SUBMISSION_REJECTED = 'submission_rejected',
55
SUBMISSION_IN_REVIEW = 'submission_in_review',
66
}

packages/apps/fortune/recording-oracle/src/modules/job/job.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ describe('JobService', () => {
485485
const expectedBody = {
486486
chain_id: jobSolution.chainId,
487487
escrow_address: jobSolution.escrowAddress,
488-
event_type: EventType.TASK_COMPLETED,
488+
event_type: EventType.JOB_COMPLETED,
489489
};
490490
expect(result).toEqual('The requested job is completed.');
491491
expect(httpServicePostMock).toHaveBeenCalledWith(
@@ -577,7 +577,7 @@ describe('JobService', () => {
577577
const expectedBody = {
578578
chain_id: jobSolution.chainId,
579579
escrow_address: jobSolution.escrowAddress,
580-
event_type: EventType.TASK_COMPLETED,
580+
event_type: EventType.JOB_COMPLETED,
581581
};
582582
expect(result).toEqual('The requested job is completed.');
583583
expect(httpServicePostMock).toHaveBeenCalledWith(

packages/apps/fortune/recording-oracle/src/modules/job/job.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export class JobService {
203203
{
204204
chainId: webhook.chainId,
205205
escrowAddress: webhook.escrowAddress,
206-
eventType: EventType.TASK_COMPLETED,
206+
eventType: EventType.JOB_COMPLETED,
207207
},
208208
this.web3ConfigService.privateKey,
209209
);

packages/apps/fortune/recording-oracle/src/modules/webhook/webhook.controller.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ describe('webhookController', () => {
130130
const webhook: WebhookDto = {
131131
chainId,
132132
escrowAddress,
133-
eventType: EventType.TASK_COMPLETED,
133+
eventType: EventType.JOB_COMPLETED,
134134
};
135135
jest.spyOn(webhookService, 'handleWebhook');
136136

137137
(verifySignature as jest.Mock).mockReturnValue(true);
138138

139139
await expect(
140140
webhookController.processWebhook(MOCK_SIGNATURE, webhook),
141-
).rejects.toThrow('Invalid webhook event type: task_completed');
141+
).rejects.toThrow('Invalid webhook event type: job_completed');
142142

143143
expect(webhookService.handleWebhook).toHaveBeenCalledWith(webhook);
144144
});

packages/apps/fortune/recording-oracle/src/modules/webhook/webhook.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ describe('WebhookService', () => {
114114
const webhook: WebhookDto = {
115115
chainId,
116116
escrowAddress,
117-
eventType: EventType.TASK_COMPLETED,
117+
eventType: EventType.JOB_COMPLETED,
118118
};
119119

120120
await expect(webhookService.handleWebhook(webhook)).rejects.toThrow(
121-
'Invalid webhook event type: task_completed',
121+
'Invalid webhook event type: job_completed',
122122
);
123123
});
124124
});

packages/apps/reputation-oracle/server/src/common/enums/webhook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export enum EventType {
2-
TASK_COMPLETED = 'task_completed',
2+
JOB_COMPLETED = 'job_completed',
33
ESCROW_COMPLETED = 'escrow_completed',
44
}
55

packages/apps/reputation-oracle/server/src/modules/webhook/webhook.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('WebhookService', () => {
105105
const validDto: WebhookDto = {
106106
chainId: ChainId.LOCALHOST,
107107
escrowAddress: MOCK_ADDRESS,
108-
eventType: EventType.TASK_COMPLETED,
108+
eventType: EventType.JOB_COMPLETED,
109109
};
110110

111111
jest
@@ -141,7 +141,7 @@ describe('WebhookService', () => {
141141
const validDto: WebhookDto = {
142142
chainId: ChainId.LOCALHOST,
143143
escrowAddress: MOCK_ADDRESS,
144-
eventType: EventType.TASK_COMPLETED,
144+
eventType: EventType.JOB_COMPLETED,
145145
};
146146

147147
jest

packages/apps/reputation-oracle/server/src/modules/webhook/webhook.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class WebhookService {
3030
* @throws {Error} - An error object if an error occurred.
3131
*/
3232
public async createIncomingWebhook(dto: WebhookDto): Promise<void> {
33-
if (dto.eventType !== EventType.TASK_COMPLETED) {
33+
if (dto.eventType !== EventType.JOB_COMPLETED) {
3434
throw new ControlledError(
3535
ErrorWebhook.InvalidEventType,
3636
HttpStatus.BAD_REQUEST,

0 commit comments

Comments
 (0)