Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -55,6 +55,7 @@ const eventHandlersJobMappings = {
notifyClientOfEvaluationV2AlignmentUpdated:
jobs.notifyClientOfEvaluationV2AlignmentUpdated,
notifyClientOfOptimizationStatus: jobs.notifyClientOfOptimizationStatus,
unassignIssuesOnDocumentsDeleted: jobs.unassignIssuesOnDocumentsDeleted,
}

export function startEventsWorker() {
Expand Down
15 changes: 15 additions & 0 deletions packages/core/src/events/events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type Events =
| 'commitMerged'
| 'commitDeleted'
| 'documentCreated'
| 'documentsDeleted'
| 'documentRunRequested'
| 'publicDocumentRunRequested'
| 'chatMessageRequested'
Expand Down Expand Up @@ -338,6 +339,18 @@ export type DocumentCreatedEvent = LatitudeEventGeneric<
}
>

export type DocumentsDeletedEvent = LatitudeEventGeneric<
'documentsDeleted',
{
workspaceId: number
projectId: number
commitUuid: string
documentUuids: string[]
softDeletedDocumentUuids: string[]
hardDeletedDocumentUuids: string[]
}
>

type CommonDataDocumentRunRequestedEvent = {
projectId: number
commitUuid: string
Expand Down Expand Up @@ -1020,6 +1033,7 @@ export type LatitudeEvent =
| CommitMergedEvent
| CommitDeletedEvent
| DocumentCreatedEvent
| DocumentsDeletedEvent
| DocumentRunRequestedEvent
| PublicDocumentRunRequestedEvent
| ChatMessageRequestedEvent
Expand Down Expand Up @@ -1114,6 +1128,7 @@ export interface IEventsHandlers {
commitMerged: EventHandler<CommitMergedEvent>[]
commitDeleted: EventHandler<CommitDeletedEvent>[]
documentCreated: EventHandler<DocumentCreatedEvent>[]
documentsDeleted: EventHandler<DocumentsDeletedEvent>[]
documentRunRequested: EventHandler<DocumentRunRequestedEvent>[]
publicDocumentRunRequested: EventHandler<PublicDocumentRunRequestedEvent>[]
chatMessageRequested: EventHandler<ChatMessageRequestedEvent>[]
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/events/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { touchProviderApiKeyJob } from './touchProviderApiKeyJob'
import { undeployDocumentTriggerJob } from './undeployDocumentTriggerJob'
import { unlockIssuesDashboardOnAnnotation } from './unlockIssuesDashboardOnAnnotation'
import { updateWebhookLastTriggeredAt } from './webhooks'
import { unassignIssuesOnDocumentsDeleted } from './unassignIssuesOnDocumentsDeleted'

export const EventHandlers: IEventsHandlers = {
claimReferralInvitations: [createClaimInvitationReferralJob],
Expand All @@ -44,6 +45,7 @@ export const EventHandlers: IEventsHandlers = {
datasetCreated: [],
datasetUploaded: [createDatasetRowsJob],
documentCreated: [],
documentsDeleted: [unassignIssuesOnDocumentsDeleted],
documentLogCreated: [notifyToClientDocumentLogCreatedJob],
experimentVariantsCreated: [],
documentSuggestionCreated: [
Expand Down
Loading
Loading