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:
@ -20,15 +20,15 @@ export class CreateAuditLogFromInternalEvent {
|
||||
|
||||
@Process(CreateAuditLogFromInternalEvent.name)
|
||||
async handle(
|
||||
data: WorkspaceEventBatch<ObjectRecordBaseEvent>,
|
||||
workspaceEventBatch: WorkspaceEventBatch<ObjectRecordBaseEvent>,
|
||||
): Promise<void> {
|
||||
for (const eventData of data.events) {
|
||||
for (const eventData of workspaceEventBatch.events) {
|
||||
let workspaceMemberId: string | null = null;
|
||||
|
||||
if (eventData.userId) {
|
||||
const workspaceMember = await this.workspaceMemberService.getByIdOrFail(
|
||||
eventData.userId,
|
||||
data.workspaceId,
|
||||
workspaceEventBatch.workspaceId,
|
||||
);
|
||||
|
||||
workspaceMemberId = workspaceMember.id;
|
||||
@ -42,13 +42,13 @@ export class CreateAuditLogFromInternalEvent {
|
||||
}
|
||||
|
||||
await this.auditLogRepository.insert(
|
||||
data.name,
|
||||
workspaceEventBatch.name,
|
||||
eventData.properties,
|
||||
workspaceMemberId,
|
||||
data.name.split('.')[0],
|
||||
workspaceEventBatch.name.split('.')[0],
|
||||
eventData.objectMetadata.id,
|
||||
eventData.recordId,
|
||||
data.workspaceId,
|
||||
workspaceEventBatch.workspaceId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,13 +18,13 @@ export class UpsertTimelineActivityFromInternalEvent {
|
||||
|
||||
@Process(UpsertTimelineActivityFromInternalEvent.name)
|
||||
async handle(
|
||||
data: WorkspaceEventBatch<ObjectRecordBaseEvent>,
|
||||
workspaceEventBatch: WorkspaceEventBatch<ObjectRecordBaseEvent>,
|
||||
): Promise<void> {
|
||||
for (const eventData of data.events) {
|
||||
for (const eventData of workspaceEventBatch.events) {
|
||||
if (eventData.userId) {
|
||||
const workspaceMember = await this.workspaceMemberService.getByIdOrFail(
|
||||
eventData.userId,
|
||||
data.workspaceId,
|
||||
workspaceEventBatch.workspaceId,
|
||||
);
|
||||
|
||||
eventData.workspaceMemberId = workspaceMember.id;
|
||||
@ -48,9 +48,9 @@ export class UpsertTimelineActivityFromInternalEvent {
|
||||
}
|
||||
|
||||
await this.timelineActivityService.upsertEvent({
|
||||
...eventData,
|
||||
workspaceId: data.workspaceId,
|
||||
name: data.name,
|
||||
event: eventData,
|
||||
eventName: workspaceEventBatch.name,
|
||||
workspaceId: workspaceEventBatch.workspaceId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user