@@ -4,6 +4,8 @@ import { OnEvent } from '@nestjs/event-emitter';
4
4
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum' ;
5
5
import { IsFeatureEnabledService } from 'src/engine/core-modules/feature-flag/services/is-feature-enabled.service' ;
6
6
import { ObjectRecordCreateEvent } from 'src/engine/integrations/event-emitter/types/object-record-create.event' ;
7
+ import { ObjectRecordDeleteEvent } from 'src/engine/integrations/event-emitter/types/object-record-delete.event' ;
8
+ import { ObjectRecordUpdateEvent } from 'src/engine/integrations/event-emitter/types/object-record-update.event' ;
7
9
import { InjectMessageQueue } from 'src/engine/integrations/message-queue/decorators/message-queue.decorator' ;
8
10
import { MessageQueue } from 'src/engine/integrations/message-queue/message-queue.constants' ;
9
11
import { MessageQueueService } from 'src/engine/integrations/message-queue/services/message-queue.service' ;
@@ -25,8 +27,27 @@ export class DatabaseEventTriggerListener {
25
27
private readonly isFeatureFlagEnabledService : IsFeatureEnabledService ,
26
28
) { }
27
29
28
- @OnEvent ( '**' )
29
- async handleEvent ( payload : ObjectRecordCreateEvent < any > ) {
30
+ @OnEvent ( '*.created' )
31
+ async handleObjectRecordCreateEvent ( payload : ObjectRecordCreateEvent < any > ) {
32
+ await this . handleEvent ( payload ) ;
33
+ }
34
+
35
+ @OnEvent ( '*.updated' )
36
+ async handleObjectRecordUpdateEvent ( payload : ObjectRecordUpdateEvent < any > ) {
37
+ await this . handleEvent ( payload ) ;
38
+ }
39
+
40
+ @OnEvent ( '*.deleted' )
41
+ async handleObjectRecordDeleteEvent ( payload : ObjectRecordDeleteEvent < any > ) {
42
+ await this . handleEvent ( payload ) ;
43
+ }
44
+
45
+ private async handleEvent (
46
+ payload :
47
+ | ObjectRecordCreateEvent < any >
48
+ | ObjectRecordUpdateEvent < any >
49
+ | ObjectRecordDeleteEvent < any > ,
50
+ ) {
30
51
const workspaceId = payload . workspaceId ;
31
52
const eventName = payload . name ;
32
53
0 commit comments