6071 return only updated fields of records in zapier update trigger (#8193)
- move webhook triggers into `entity-events-to-db.listener.ts` - refactor event management - add a `@OnDatabaseEvent` decorator to manage database events - add updatedFields in updated events - update openApi webhooks docs - update zapier integration
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { Injectable, Scope } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
import { ObjectRecordCreateEvent } from 'src/engine/core-modules/event-emitter/types/object-record-create.event';
|
||||
import { ObjectRecordDeleteEvent } from 'src/engine/core-modules/event-emitter/types/object-record-delete.event';
|
||||
@ -17,6 +16,8 @@ import {
|
||||
BlocklistReimportMessagesJob,
|
||||
BlocklistReimportMessagesJobData,
|
||||
} from 'src/modules/messaging/blocklist-manager/jobs/messaging-blocklist-reimport-messages.job';
|
||||
import { OnDatabaseEvent } from 'src/engine/api/graphql/graphql-query-runner/decorators/on-database-event.decorator';
|
||||
import { DatabaseEventAction } from 'src/engine/api/graphql/graphql-query-runner/enums/database-event-action';
|
||||
|
||||
@Injectable({ scope: Scope.REQUEST })
|
||||
export class MessagingBlocklistListener {
|
||||
@ -25,7 +26,7 @@ export class MessagingBlocklistListener {
|
||||
private readonly messageQueueService: MessageQueueService,
|
||||
) {}
|
||||
|
||||
@OnEvent('blocklist.created')
|
||||
@OnDatabaseEvent('blocklist', DatabaseEventAction.CREATED)
|
||||
async handleCreatedEvent(
|
||||
payload: WorkspaceEventBatch<
|
||||
ObjectRecordCreateEvent<BlocklistWorkspaceEntity>
|
||||
@ -37,7 +38,7 @@ export class MessagingBlocklistListener {
|
||||
);
|
||||
}
|
||||
|
||||
@OnEvent('blocklist.deleted')
|
||||
@OnDatabaseEvent('blocklist', DatabaseEventAction.CREATED)
|
||||
async handleDeletedEvent(
|
||||
payload: WorkspaceEventBatch<
|
||||
ObjectRecordDeleteEvent<BlocklistWorkspaceEntity>
|
||||
@ -49,7 +50,7 @@ export class MessagingBlocklistListener {
|
||||
);
|
||||
}
|
||||
|
||||
@OnEvent('blocklist.updated')
|
||||
@OnDatabaseEvent('blocklist', DatabaseEventAction.UPDATED)
|
||||
async handleUpdatedEvent(
|
||||
payload: WorkspaceEventBatch<
|
||||
ObjectRecordUpdateEvent<BlocklistWorkspaceEntity>
|
||||
|
||||
Reference in New Issue
Block a user