chore(server): event bus refactor - version emitter - batch #2
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
GetStreamBranchByName,
|
||||
MarkCommitBranchUpdated
|
||||
} from '@/modules/core/domain/branches/operations'
|
||||
import { VersionEvents } from '@/modules/core/domain/commits/events'
|
||||
import {
|
||||
CreateCommitByBranchId,
|
||||
CreateCommitByBranchName,
|
||||
@@ -36,10 +37,6 @@ import {
|
||||
CommitReceiveError,
|
||||
CommitUpdateError
|
||||
} from '@/modules/core/errors/commit'
|
||||
import {
|
||||
VersionEvents,
|
||||
VersionsEventEmitter
|
||||
} from '@/modules/core/events/versionsEmitter'
|
||||
import {
|
||||
CommitReceivedInput,
|
||||
CommitUpdateInput,
|
||||
@@ -47,6 +44,7 @@ import {
|
||||
UpdateVersionInput
|
||||
} from '@/modules/core/graph/generated/graphql'
|
||||
import { BranchRecord, CommitRecord } from '@/modules/core/helpers/types'
|
||||
import { EventBusEmit } from '@/modules/shared/services/eventBus'
|
||||
import { ensureError, Roles } from '@speckle/shared'
|
||||
import { has } from 'lodash'
|
||||
|
||||
@@ -100,8 +98,8 @@ export const createCommitByBranchIdFactory =
|
||||
insertBranchCommits: InsertBranchCommits
|
||||
markCommitStreamUpdated: MarkCommitStreamUpdated
|
||||
markCommitBranchUpdated: MarkCommitBranchUpdated
|
||||
versionsEventEmitter: VersionsEventEmitter
|
||||
addCommitCreatedActivity: AddCommitCreatedActivity
|
||||
emitEvent: EventBusEmit
|
||||
}): CreateCommitByBranchId =>
|
||||
async (params, options) => {
|
||||
const {
|
||||
@@ -153,10 +151,13 @@ export const createCommitByBranchIdFactory =
|
||||
await Promise.all([
|
||||
deps.markCommitStreamUpdated(id),
|
||||
deps.markCommitBranchUpdated(id),
|
||||
deps.versionsEventEmitter(VersionEvents.Created, {
|
||||
projectId: streamId,
|
||||
modelId: branchId,
|
||||
version: commit
|
||||
deps.emitEvent({
|
||||
eventName: VersionEvents.Created,
|
||||
payload: {
|
||||
projectId: streamId,
|
||||
modelId: branchId,
|
||||
version: commit
|
||||
}
|
||||
}),
|
||||
...(notify
|
||||
? [
|
||||
|
||||
Reference in New Issue
Block a user