WEB-1140 manage user workspace membership services (#2460)

* feat(workspaces): drop createdByUserId from the dataschema

* feat(workspaces): repositories WIP

* merge

* protect against removing last admin in workspace

* quick impl and stub tests

* add tests

* services

* unit tests for role services

* fix(workspaces): maybe tests work like this

* fix(workspaces): dry

* fix(workspaces): initialize tests better

* fix(workspaces): so true

* fix(workspaces): right

* fix(workspaces): self nit

* fix(workspaces): better repository structure

* fix(workspaces): repair tests, use `example.org`

* fix(workspaces): add tests for new repo functions, repair other tests

* fix(workspaces): better distinction between service-level guarantees and repo-level guarantees

* fix(workspaces): review comments and stencil tests

* fix(workspaces): add tests

* fix(workspaces): tests work

---------

Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
This commit is contained in:
Chuck Driesler
2024-07-09 17:26:59 +01:00
committed by GitHub
parent a72ef6178d
commit e703bb7415
10 changed files with 593 additions and 18 deletions
@@ -1,13 +1,19 @@
import { Workspace } from '@/modules/workspaces/domain/types'
import { Workspace, WorkspaceAcl } from '@/modules/workspaces/domain/types'
export const WorkspaceEvents = {
Created: 'created'
Created: 'created',
RoleDeleted: 'role-deleted',
RoleUpdated: 'role-updated'
} as const
export type WorkspaceEvents = (typeof WorkspaceEvents)[keyof typeof WorkspaceEvents]
type WorkspaceCreatedPayload = Workspace
type WorkspaceRoleDeletedPayload = WorkspaceAcl
type WorkspaceRoleUpdatedPayload = WorkspaceAcl
export type WorkspaceEventsPayloads = {
[WorkspaceEvents.Created]: WorkspaceCreatedPayload
[WorkspaceEvents.RoleDeleted]: WorkspaceRoleDeletedPayload
[WorkspaceEvents.RoleUpdated]: WorkspaceRoleUpdatedPayload
}