From ec3be7e4d362464a40722240e6210dfb45caed5f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 3 Apr 2022 22:42:01 +0900 Subject: [PATCH] enhance(webhook): add userId to payload --- packages/backend/src/queue/index.ts | 1 + packages/backend/src/queue/processors/webhook-deliver.ts | 1 + packages/backend/src/queue/types.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/backend/src/queue/index.ts b/packages/backend/src/queue/index.ts index 5bd922468..2d40290e4 100644 --- a/packages/backend/src/queue/index.ts +++ b/packages/backend/src/queue/index.ts @@ -268,6 +268,7 @@ export function webhookDeliver(webhook: Webhook, type: typeof webhookEventTypes[ type, content, webhookId: webhook.id, + userId: webhook.userId, to: webhook.url, secret: webhook.secret, createdAt: Date.now(), diff --git a/packages/backend/src/queue/processors/webhook-deliver.ts b/packages/backend/src/queue/processors/webhook-deliver.ts index 01d779311..d49206f68 100644 --- a/packages/backend/src/queue/processors/webhook-deliver.ts +++ b/packages/backend/src/queue/processors/webhook-deliver.ts @@ -23,6 +23,7 @@ export default async (job: Bull.Job) => { }, body: JSON.stringify({ hookId: job.data.webhookId, + userId: job.data.userId, eventId: job.data.eventId, createdAt: job.data.createdAt, type: job.data.type, diff --git a/packages/backend/src/queue/types.ts b/packages/backend/src/queue/types.ts index c005f78ec..6c0b9d9bf 100644 --- a/packages/backend/src/queue/types.ts +++ b/packages/backend/src/queue/types.ts @@ -51,6 +51,7 @@ export type WebhookDeliverJobData = { type: string; content: unknown; webhookId: Webhook['id']; + userId: User['id']; to: string; secret: string; createdAt: number;