Skip to content

Commit

Permalink
fix wrong payload
Browse files Browse the repository at this point in the history
  • Loading branch information
bosiraphael committed Aug 20, 2024
1 parent a63706f commit 3ef6831
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,16 @@ export class EntityEventsToDbListener {
}

private async handle(payload: WorkspaceEventBatch<ObjectRecordBaseEvent>) {
for (const eventPayload of payload.events) {
if (!eventPayload.objectMetadata?.isAuditLogged) {
continue;
}
payload.events = payload.events.filter(
(event) => event.objectMetadata?.isAuditLogged,
);

await Promise.all([
this.messageQueueService.add<ObjectRecordBaseEvent>(
CreateAuditLogFromInternalEvent.name,
eventPayload,
),
this.messageQueueService.add<ObjectRecordBaseEvent>(
UpsertTimelineActivityFromInternalEvent.name,
eventPayload,
),
]);
}
await this.messageQueueService.add<
WorkspaceEventBatch<ObjectRecordBaseEvent>
>(CreateAuditLogFromInternalEvent.name, payload);

await this.messageQueueService.add<
WorkspaceEventBatch<ObjectRecordBaseEvent>
>(UpsertTimelineActivityFromInternalEvent.name, payload);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export class WorkspaceEventEmitter {
constructor(private readonly eventEmitter: EventEmitter2) {}

public emit(eventName: string, events: any[], workspaceId: string) {
if (!events.length) {
return;
}

return this.eventEmitter.emit(eventName, {
name: eventName,
workspaceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class CalendarSaveEventsService {
[
{
workspaceMemberId: connectedAccount.accountOwnerId,
calendarEventParticipants: savedCalendarEventParticipantsToEmit,
participants: savedCalendarEventParticipantsToEmit,
},
],
workspaceId,
Expand Down

0 comments on commit 3ef6831

Please sign in to comment.