Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing creators data to webhook (#6726) #6749

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CallWebhookJob,
CallWebhookJobData,
} from 'src/engine/api/graphql/workspace-query-runner/jobs/call-webhook.job';
import { User } from 'src/engine/core-modules/user/user.entity';
import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator';
import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator';
import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator';
Expand All @@ -27,6 +28,7 @@ export type CallWebhookJobsJobData = {
objectMetadataItem: ObjectMetadataInterface;
record: any;
operation: CallWebhookJobsJobOperation;
creatorDetails: Pick<User, 'firstName' | 'lastName'>;
naineel1209 marked this conversation as resolved.
Show resolved Hide resolved
};

@Processor(MessageQueue.webhookQueue)
Expand All @@ -50,6 +52,7 @@ export class CallWebhookJobsJob {
const nameSingular = data.objectMetadataItem.nameSingular;
const operation = data.operation;
const eventName = `${nameSingular}.${operation}`;
const creatorDetails = data.creatorDetails;

const webhooks = await webhookRepository.find({
where: [
Expand All @@ -74,6 +77,7 @@ export class CallWebhookJobsJob {
webhookId: webhook.id,
eventDate: new Date(),
record: data.record,
creatorDetails,
},
{ retryLimit: 3 },
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpService } from '@nestjs/axios';
import { Logger } from '@nestjs/common';

import { User } from 'src/engine/core-modules/user/user.entity';
import { Process } from 'src/engine/integrations/message-queue/decorators/process.decorator';
import { Processor } from 'src/engine/integrations/message-queue/decorators/processor.decorator';
import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants';
Expand All @@ -13,6 +14,7 @@ export type CallWebhookJobData = {
webhookId: string;
eventDate: Date;
record: any;
creatorDetails: Pick<User, 'firstName' | 'lastName'>;
};

@Processor(MessageQueue.webhookQueue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,10 @@ export class WorkspaceQueryRunnerService {
workspaceId: options.authContext.workspace.id,
operation,
objectMetadataItem: options.objectMetadataItem,
creatorDetails: {
firstName: options.authContext.user?.firstName as string,
lastName: options.authContext.user?.lastName as string,
},
},
{ retryLimit: 3 },
);
Expand Down
Loading