8cba7eb6f7
* feat(gatekeeper): add gatekeeper module feature flag * feat(gatekeeper): add workspace pricing table domain * feat(gatekeeper): add checkout session creation * feat(gatekeeper): verify stripe signature * wip(gatekeeper): checkout callbacks * feat(gatekeeper): add unlimited and academia plan types * refactor(envHelper): getStringFromEnv helper * chore(gatekeeper): add future todos * feat(gatekeeper): add productId to the subscription domain * feat(gatekeeper): add in memory repositories * feat(gatekeeper): add more errors * feat(gatekeeper): complete checkout session service * feat(gatekeeper): add stripe client implementation * feat(gatekeeper): add checkout session completion webhook callback path * feat(gendo): fix not needing env vars if gendo module is not enabled * feat(gatekeeper): require a license for billing * chore(gatekeeper): cleanup before testing * feat(gatekeeper): subscriptionData parsing model * ci: add billing integration and gatekeeper modules to test config * test(gatekeeper): add checkout service tests * feat(gatekeeper): make completeCheckout callback idempotent properly * feat(gatekeeper): move to knex based repositories * test(gatekeeper): billing repository tests * feat(gatekeeper): add yearly billing cycle toggle * feat(ci): add stripe integration context to test job * feat(billingPage): conditionally render the checkout CTAs * fix(gatekeeper): remove flaky test condition * feat(helm): add billing integration feature flag
28 lines
974 B
TypeScript
28 lines
974 B
TypeScript
import { UpsertWorkspace } from '@/modules/workspaces/domain/operations'
|
|
import { Workspace } from '@/modules/workspacesCore/domain/types'
|
|
import { Roles } from '@speckle/shared'
|
|
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,
|
|
defaultLogoIndex: 0,
|
|
defaultProjectRole: Roles.Stream.Contributor,
|
|
...workspaceOverrides
|
|
}
|
|
|
|
await upsertWorkspace({ workspace })
|
|
|
|
return workspace
|
|
}
|