a0224e2f40
* chore(workspaces): workspace cost schema * chore(workspaces): test helper for workspace cost * feat(workspaces): workspace billing cost * fix(workspaces): fix onProjectCreated failing for the project creator if the creator is a member * refactor(workspaces): change workspace cost calculation to a simpler query * test(workspaceCost): fix costing logic and tests * fix(workspaceTests): project emmiter needs owner now --------- Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
20 lines
613 B
TypeScript
20 lines
613 B
TypeScript
import { StreamRecord } from '@/modules/core/helpers/types'
|
|
import { initializeModuleEventEmitter } from '@/modules/shared/services/moduleEventEmitterSetup'
|
|
|
|
export const ProjectEvents = {
|
|
Created: 'created'
|
|
} as const
|
|
|
|
export type ProjectEvents = (typeof ProjectEvents)[keyof typeof ProjectEvents]
|
|
|
|
export type ProjectEventsPayloads = {
|
|
[ProjectEvents.Created]: { project: StreamRecord; ownerId: string }
|
|
}
|
|
|
|
const { emit, listen } = initializeModuleEventEmitter<ProjectEventsPayloads>({
|
|
moduleName: 'core',
|
|
namespace: 'projects'
|
|
})
|
|
|
|
export const ProjectsEmitter = { emit, listen, events: ProjectEvents }
|