Files
speckle-server/packages/server/modules/core/events/usersEmitter.ts
T
2024-10-15 12:55:33 +03:00

20 lines
611 B
TypeScript

import { UserRecord } from '@/modules/core/helpers/types'
import { initializeModuleEventEmitter } from '@/modules/shared/services/moduleEventEmitterSetup'
export enum UsersEvents {
Created = 'created'
}
export type UsersEventsPayloads = {
[UsersEvents.Created]: { user: UserRecord }
}
const { emit, listen } = initializeModuleEventEmitter<UsersEventsPayloads>({
moduleName: 'core',
namespace: 'users'
})
export const UsersEmitter = { emit, listen, events: UsersEvents }
export type UsersEventsEmitter = (typeof UsersEmitter)['emit']
export type UsersEventsListener = (typeof UsersEmitter)['listen']