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:
@@ -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 }
|
||||
Reference in New Issue
Block a user