Files
speckle-server/packages/server/test/speckle-helpers/workspaces.ts
T
Chuck Driesler 0f5c22329b Chuck/web 3465 auto join discoverable workspace setting (#4791)
* feat(workspaces): enable toggle for auto-join discoverable workspaces

* fix(workspaces): include auto-join flag on LimitedWorkspace

* chore(workspaces): gqlgen
2025-05-22 10:11:05 +01:00

27 lines
943 B
TypeScript

import { UpsertWorkspace } from '@/modules/workspaces/domain/operations'
import { Workspace } from '@/modules/workspacesCore/domain/types'
import cryptoRandomString from 'crypto-random-string'
export const createAndStoreTestWorkspaceFactory =
({ upsertWorkspace }: { upsertWorkspace: UpsertWorkspace }) =>
async (workspaceOverrides: Partial<Workspace> = {}) => {
const workspace: Omit<Workspace, 'domains'> = {
id: cryptoRandomString({ length: 10 }),
slug: cryptoRandomString({ length: 10 }),
name: cryptoRandomString({ length: 10 }),
createdAt: new Date(),
updatedAt: new Date(),
description: null,
logo: null,
domainBasedMembershipProtectionEnabled: false,
discoverabilityEnabled: false,
discoverabilityAutoJoinEnabled: false,
isEmbedSpeckleBrandingHidden: false,
...workspaceOverrides
}
await upsertWorkspace({ workspace })
return workspace
}