chore(workspaces): drop defaultLogoIndex (#3898)

This commit is contained in:
Chuck Driesler
2025-01-28 07:56:13 +00:00
committed by GitHub
parent 57751db6d7
commit 35b59ca4f2
22 changed files with 26 additions and 91 deletions
@@ -69,12 +69,5 @@ export const isWorkspaceRole = (role: string): role is WorkspaceRoles => {
}
export const toLimitedWorkspace = (workspace: Workspace): LimitedWorkspace => {
return pick(workspace, [
'id',
'slug',
'name',
'description',
'logo',
'defaultLogoIndex'
])
return pick(workspace, ['id', 'slug', 'name', 'description', 'logo'])
}
@@ -38,7 +38,6 @@ export type UpsertWorkspaceArgs = {
NullableKeysToOptional<Workspace>,
| 'domainBasedMembershipProtectionEnabled'
| 'discoverabilityEnabled'
| 'defaultLogoIndex'
| 'defaultProjectRole'
| 'slug'
>,
@@ -51,12 +50,7 @@ export type UpsertWorkspace = (args: UpsertWorkspaceArgs) => Promise<void>
export type GetUserDiscoverableWorkspaces = (args: {
domains: string[]
userId: string
}) => Promise<
Pick<
Workspace,
'id' | 'name' | 'slug' | 'description' | 'logo' | 'defaultLogoIndex'
>[]
>
}) => Promise<Pick<Workspace, 'id' | 'name' | 'slug' | 'description' | 'logo'>[]>
export type GetWorkspace = (args: {
workspaceId: string
@@ -135,7 +135,6 @@ const config: SpeckleModuleMocksConfig = FF_WORKSPACES_MODULE_ENABLED
id: faker.string.uuid(),
name: workspaceName(),
description: faker.lorem.sentence(),
defaultLogoIndex: 0,
logo: null
}
]),
@@ -510,7 +510,7 @@ export = FF_WORKSPACES_MODULE_ENABLED
},
WorkspaceMutations: {
create: async (_parent, args, context) => {
const { name, description, defaultLogoIndex, logo, slug } = args.input
const { name, description, logo, slug } = args.input
const createWorkspace = createWorkspaceFactory({
validateSlug: validateSlugFactory({
@@ -530,8 +530,7 @@ export = FF_WORKSPACES_MODULE_ENABLED
name,
slug,
description: description ?? null,
logo: logo ?? null,
defaultLogoIndex: defaultLogoIndex ?? 0
logo: logo ?? null
},
userResourceAccessLimits: context.resourceAccessRules
})
@@ -81,14 +81,7 @@ export const getUserDiscoverableWorkspacesFactory =
}
return (await tables
.workspaces(db)
.select(
'workspaces.id as id',
'name',
'slug',
'description',
'logo',
'defaultLogoIndex'
)
.select('workspaces.id as id', 'name', 'slug', 'description', 'logo')
.distinctOn('workspaces.id')
.join('workspace_domains', 'workspace_domains.workspaceId', 'workspaces.id')
.leftJoin(
@@ -111,7 +104,7 @@ export const getUserDiscoverableWorkspacesFactory =
.where('verified', true)
.where('role', null)) as Pick<
Workspace,
'id' | 'name' | 'slug' | 'description' | 'logo' | 'defaultLogoIndex'
'id' | 'name' | 'slug' | 'description' | 'logo'
>[]
}
@@ -237,7 +230,6 @@ export const upsertWorkspaceFactory =
'description',
'logo',
'slug',
'defaultLogoIndex',
'defaultProjectRole',
'name',
'updatedAt',
@@ -378,7 +378,6 @@ const handleGetLimitedWorkspaceRequestFactory =
const limitedWorkspace = {
name: workspace.name,
logo: workspace.logo,
defaultLogoIndex: workspace.defaultLogoIndex,
ssoProviderName: ssoProviderData?.provider?.providerName
}
@@ -76,7 +76,6 @@ type WorkspaceCreateArgs = {
slug?: string | null
description: string | null
logo: string | null
defaultLogoIndex: number
}
userResourceAccessLimits: MaybeNullOrUndefined<TokenResourceIdentifier[]>
}
@@ -22,10 +22,7 @@ export const getDiscoverableWorkspacesForUserFactory =
async ({
userId
}: GetDiscoverableWorkspaceForUserArgs): Promise<
Pick<
Workspace,
'id' | 'name' | 'slug' | 'description' | 'logo' | 'defaultLogoIndex'
>[]
Pick<Workspace, 'id' | 'name' | 'slug' | 'description' | 'logo'>[]
> => {
const userEmails = await findEmailsByUserId({ userId })
const userVerifiedDomains = userEmails
@@ -140,8 +140,7 @@ export const createTestWorkspace = async (
name: workspace.name,
slug: workspace.slug || cryptoRandomString({ length: 10 }),
description: workspace.description || null,
logo: workspace.logo || null,
defaultLogoIndex: 0
logo: workspace.logo || null
},
userResourceAccessLimits: null
})
@@ -21,7 +21,6 @@ describe('workspace domain services', () => {
it('returns null if the workspace is not domain protected', async () => {
const isCompliant = await isUserWorkspaceDomainPolicyCompliantFactory({
getWorkspaceWithDomains: async () => ({
defaultLogoIndex: 0,
name: cryptoRandomString({ length: 10 }),
logo: null,
slug: cryptoRandomString({ length: 10 }),
@@ -45,7 +44,6 @@ describe('workspace domain services', () => {
const domain = 'example.com'
const isCompliant = await isUserWorkspaceDomainPolicyCompliantFactory({
getWorkspaceWithDomains: async () => ({
defaultLogoIndex: 0,
name: cryptoRandomString({ length: 10 }),
logo: null,
slug: cryptoRandomString({ length: 10 }),
@@ -31,8 +31,7 @@ const createTestWorkspaceWithDomains = (
domains: [],
discoverabilityEnabled: false,
domainBasedMembershipProtectionEnabled: false,
defaultProjectRole: Roles.Stream.Contributor,
defaultLogoIndex: 0
defaultProjectRole: Roles.Stream.Contributor
}
if (arg) assign(workspace, arg)
return workspace
@@ -93,8 +93,7 @@ const getCreateWorkspaceInput = () => {
description: 'foobar',
slug: cryptoRandomString({ length: 10 }),
logo: null,
name: cryptoRandomString({ length: 6 }),
defaultLogoIndex: 0
name: cryptoRandomString({ length: 6 })
}
}
}
@@ -258,7 +257,6 @@ describe('Workspace services', () => {
createdAt: new Date(),
updatedAt: new Date(),
logo: null,
defaultLogoIndex: 0,
discoverabilityEnabled: false,
domainBasedMembershipProtectionEnabled: false,
defaultProjectRole: 'stream:contributor',
@@ -1094,8 +1092,7 @@ describe('Workspace role services', () => {
description: null,
discoverabilityEnabled: false,
domainBasedMembershipProtectionEnabled: false,
defaultProjectRole: 'stream:contributor',
defaultLogoIndex: 0
defaultProjectRole: 'stream:contributor'
}
},
getDomains: async () => {
@@ -1135,8 +1132,7 @@ describe('Workspace role services', () => {
description: null,
discoverabilityEnabled: false,
domainBasedMembershipProtectionEnabled: false,
defaultProjectRole: 'stream:contributor',
defaultLogoIndex: 0
defaultProjectRole: 'stream:contributor'
}
await addDomainToWorkspaceFactory({
@@ -381,7 +381,6 @@ describe('Workspace SSO services', () => {
name: '',
description: '',
logo: null,
defaultLogoIndex: 0,
defaultProjectRole: 'stream:contributor',
domainBasedMembershipProtectionEnabled: false,
discoverabilityEnabled: false,