gergo/eventBus (#2498)

* feat(eventBus): WIP event bus typescript wizardy

* feat(eventBus): final eventbus setup with all the typescript foo

* fix(workspaces): fix workspace core imports

* test(workspaces): fix expected events name

* test(workspaces): fix tests
This commit is contained in:
Gergő Jedlicska
2024-07-12 15:35:40 +02:00
committed by GitHub
parent 4da196ec48
commit ee6e5e22b1
14 changed files with 355 additions and 32 deletions
@@ -1,14 +1,20 @@
import { Workspace, WorkspaceAcl } from '@/modules/workspaces/domain/types'
import { Workspace, WorkspaceAcl } from '@/modules/workspacesCore/domain/types'
export const workspaceEventNamespace = 'workspace' as const
const workspaceEventPrefix = `${workspaceEventNamespace}.` as const
export const WorkspaceEvents = {
Created: 'created',
RoleDeleted: 'role-deleted',
RoleUpdated: 'role-updated'
Created: `${workspaceEventPrefix}created`,
RoleDeleted: `${workspaceEventPrefix}role-deleted`,
RoleUpdated: `${workspaceEventPrefix}role-updated`
} as const
export type WorkspaceEvents = (typeof WorkspaceEvents)[keyof typeof WorkspaceEvents]
type WorkspaceCreatedPayload = Workspace
type WorkspaceCreatedPayload = Workspace & {
createdByUserId: string
}
type WorkspaceRoleDeletedPayload = WorkspaceAcl
type WorkspaceRoleUpdatedPayload = WorkspaceAcl
@@ -0,0 +1,12 @@
import { WorkspaceRoles } from '@speckle/shared'
export type Workspace = {
id: string
name: string
description: string | null
createdAt: Date
updatedAt: Date
logoUrl: string | null
}
export type WorkspaceAcl = { userId: string; role: WorkspaceRoles; workspaceId: string }