Files
speckle-server/packages/server/test/speckle-helpers/workspaces.ts
T
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

29 lines
1008 B
TypeScript

import type { UpsertWorkspace } from '@/modules/workspaces/domain/operations'
import type { 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,
isExclusive: false,
domainBasedMembershipProtectionEnabled: false,
discoverabilityEnabled: false,
discoverabilityAutoJoinEnabled: false,
defaultSeatType: null,
isEmbedSpeckleBrandingHidden: false,
...workspaceOverrides
}
await upsertWorkspace({ workspace })
return workspace
}