From a9dd835de93cb4be08e31c4ea90f45e86a498883 Mon Sep 17 00:00:00 2001 From: Alessandro Magionami Date: Tue, 25 Feb 2025 12:19:50 +0100 Subject: [PATCH] feat(workspaces): team resolver for limited workspace (#4040) --- .../typedefs/workspaces.graphql | 14 ++++ .../modules/core/graph/generated/graphql.ts | 40 +++++++++ .../graph/generated/graphql.ts | 21 +++++ .../workspaces/graph/resolvers/workspaces.ts | 18 ++++ .../integration/workspaces.graph.spec.ts | 84 ++++++++++++++++++- .../server/test/graphql/generated/graphql.ts | 25 +++++- packages/server/test/graphql/workspaces.ts | 7 ++ 7 files changed, 205 insertions(+), 4 deletions(-) diff --git a/packages/server/assets/workspacesCore/typedefs/workspaces.graphql b/packages/server/assets/workspacesCore/typedefs/workspaces.graphql index 2242272e9..6b0528061 100644 --- a/packages/server/assets/workspacesCore/typedefs/workspaces.graphql +++ b/packages/server/assets/workspacesCore/typedefs/workspaces.graphql @@ -367,6 +367,20 @@ type LimitedWorkspace { Optional base64 encoded workspace logo image """ logo: String + """ + Workspace members visible to people with verified email domain + """ + team(cursor: String, limit: Int! = 25): DiscoverableWorkspaceCollaboratorCollection +} + +type DiscoverableWorkspaceCollaboratorCollection { + totalCount: Int! + cursor: String + items: [DiscoverableWorkspaceCollaborator!]! +} + +type DiscoverableWorkspaceCollaborator { + avatar: String } type WorkspaceDomain { diff --git a/packages/server/modules/core/graph/generated/graphql.ts b/packages/server/modules/core/graph/generated/graphql.ts index a3aca3949..b70c8fdc0 100644 --- a/packages/server/modules/core/graph/generated/graphql.ts +++ b/packages/server/modules/core/graph/generated/graphql.ts @@ -960,6 +960,18 @@ export type DiscoverableStreamsSortingInput = { type: DiscoverableStreamsSortType; }; +export type DiscoverableWorkspaceCollaborator = { + __typename?: 'DiscoverableWorkspaceCollaborator'; + avatar: Scalars['String']['output']; +}; + +export type DiscoverableWorkspaceCollaboratorCollection = { + __typename?: 'DiscoverableWorkspaceCollaboratorCollection'; + cursor?: Maybe; + items: Array; + totalCount: Scalars['Int']['output']; +}; + export type EditCommentInput = { commentId: Scalars['String']['input']; content: CommentContentInput; @@ -1173,6 +1185,15 @@ export type LimitedWorkspace = { name: Scalars['String']['output']; /** Unique workspace short id. Used for navigation. */ slug: Scalars['String']['output']; + /** Workspace members visible to people with verified email domain */ + team?: Maybe; +}; + + +/** Workspace metadata visible to non-workspace members. */ +export type LimitedWorkspaceTeamArgs = { + cursor?: InputMaybe; + limit?: Scalars['Int']['input']; }; export type LimitedWorkspaceJoinRequest = { @@ -4947,6 +4968,8 @@ export type ResolversTypes = { DenyWorkspaceJoinRequestInput: DenyWorkspaceJoinRequestInput; DiscoverableStreamsSortType: DiscoverableStreamsSortType; DiscoverableStreamsSortingInput: DiscoverableStreamsSortingInput; + DiscoverableWorkspaceCollaborator: ResolverTypeWrapper; + DiscoverableWorkspaceCollaboratorCollection: ResolverTypeWrapper; EditCommentInput: EditCommentInput; EmailVerificationRequestInput: EmailVerificationRequestInput; FileUpload: ResolverTypeWrapper; @@ -5252,6 +5275,8 @@ export type ResolversParentTypes = { DeleteVersionsInput: DeleteVersionsInput; DenyWorkspaceJoinRequestInput: DenyWorkspaceJoinRequestInput; DiscoverableStreamsSortingInput: DiscoverableStreamsSortingInput; + DiscoverableWorkspaceCollaborator: DiscoverableWorkspaceCollaborator; + DiscoverableWorkspaceCollaboratorCollection: DiscoverableWorkspaceCollaboratorCollection; EditCommentInput: EditCommentInput; EmailVerificationRequestInput: EmailVerificationRequestInput; FileUpload: FileUploadGraphQLReturn; @@ -5882,6 +5907,18 @@ export interface DateTimeScalarConfig extends GraphQLScalarTypeConfig = { + avatar?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + +export type DiscoverableWorkspaceCollaboratorCollectionResolvers = { + cursor?: Resolver, ParentType, ContextType>; + items?: Resolver, ParentType, ContextType>; + totalCount?: Resolver; + __isTypeOf?: IsTypeOfResolverFn; +}; + export type FileUploadResolvers = { branchName?: Resolver; convertedCommitId?: Resolver, ParentType, ContextType>; @@ -5963,6 +6000,7 @@ export type LimitedWorkspaceResolvers, ParentType, ContextType>; name?: Resolver; slug?: Resolver; + team?: Resolver, ParentType, ContextType, RequireFields>; __isTypeOf?: IsTypeOfResolverFn; }; @@ -7113,6 +7151,8 @@ export type Resolvers = { CommitCollection?: CommitCollectionResolvers; CountOnlyCollection?: CountOnlyCollectionResolvers; DateTime?: GraphQLScalarType; + DiscoverableWorkspaceCollaborator?: DiscoverableWorkspaceCollaboratorResolvers; + DiscoverableWorkspaceCollaboratorCollection?: DiscoverableWorkspaceCollaboratorCollectionResolvers; FileUpload?: FileUploadResolvers; GendoAIRender?: GendoAiRenderResolvers; GendoAIRenderCollection?: GendoAiRenderCollectionResolvers; diff --git a/packages/server/modules/cross-server-sync/graph/generated/graphql.ts b/packages/server/modules/cross-server-sync/graph/generated/graphql.ts index 96f54d600..4559b4ecd 100644 --- a/packages/server/modules/cross-server-sync/graph/generated/graphql.ts +++ b/packages/server/modules/cross-server-sync/graph/generated/graphql.ts @@ -941,6 +941,18 @@ export type DiscoverableStreamsSortingInput = { type: DiscoverableStreamsSortType; }; +export type DiscoverableWorkspaceCollaborator = { + __typename?: 'DiscoverableWorkspaceCollaborator'; + avatar: Scalars['String']['output']; +}; + +export type DiscoverableWorkspaceCollaboratorCollection = { + __typename?: 'DiscoverableWorkspaceCollaboratorCollection'; + cursor?: Maybe; + items: Array; + totalCount: Scalars['Int']['output']; +}; + export type EditCommentInput = { commentId: Scalars['String']['input']; content: CommentContentInput; @@ -1154,6 +1166,15 @@ export type LimitedWorkspace = { name: Scalars['String']['output']; /** Unique workspace short id. Used for navigation. */ slug: Scalars['String']['output']; + /** Workspace members visible to people with verified email domain */ + team?: Maybe; +}; + + +/** Workspace metadata visible to non-workspace members. */ +export type LimitedWorkspaceTeamArgs = { + cursor?: InputMaybe; + limit?: Scalars['Int']['input']; }; export type LimitedWorkspaceJoinRequest = { diff --git a/packages/server/modules/workspaces/graph/resolvers/workspaces.ts b/packages/server/modules/workspaces/graph/resolvers/workspaces.ts index 1b4995e87..a35dde9d4 100644 --- a/packages/server/modules/workspaces/graph/resolvers/workspaces.ts +++ b/packages/server/modules/workspaces/graph/resolvers/workspaces.ts @@ -200,6 +200,8 @@ import { sendWorkspaceJoinRequestReceivedEmailFactory } from '@/modules/workspac import { getProjectFactory } from '@/modules/core/repositories/projects' import { OperationTypeNode } from 'graphql' import { updateWorkspacePlanFactory } from '@/modules/gatekeeper/services/workspacePlans' +import { GetWorkspaceCollaboratorsArgs } from '@/modules/workspaces/domain/operations' +import { WorkspaceTeamMember } from '@/modules/workspaces/domain/types' const eventBus = getEventBus() const getServerInfo = getServerInfoFactory({ db }) @@ -1368,6 +1370,22 @@ export = FF_WORKSPACES_MODULE_ENABLED ServerWorkspacesInfo: { workspacesEnabled: () => true }, + LimitedWorkspace: { + team: async (parent, args) => { + const team = await getPaginatedItemsFactory< + Pick, + WorkspaceTeamMember + >({ + getItems: getWorkspaceCollaboratorsFactory({ db }), + getTotalCount: getWorkspaceCollaboratorsTotalCountFactory({ db }) + })({ + workspaceId: parent.id, + limit: args.limit, + cursor: args.cursor ?? undefined + }) + return team + } + }, Subscription: { workspaceProjectsUpdated: { subscribe: filteredSubscribe( diff --git a/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts b/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts index 261665f2c..e7079d554 100644 --- a/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts +++ b/packages/server/modules/workspaces/tests/integration/workspaces.graph.spec.ts @@ -9,7 +9,8 @@ import { BasicTestUser, createAuthTokenForUser, createTestUser, - createTestUsers + createTestUsers, + login } from '@/test/authHelper' import { Roles, wait, WorkspaceRoles } from '@speckle/shared' import { @@ -27,7 +28,8 @@ import { AddWorkspaceDomainDocument, DeleteWorkspaceDomainDocument, CreateWorkspaceProjectDocument, - DismissWorkspaceDocument + DismissWorkspaceDocument, + GetActiveUserDiscoverableWorkspacesDocument } from '@/test/graphql/generated/graphql' import { beforeEachContext } from '@/test/hooks' import { AllScopes } from '@/modules/core/helpers/mainConstants' @@ -490,6 +492,84 @@ describe('Workspaces GQL CRUD', () => { }) }) + describe('LimitedWorkspace.team', () => { + it('should return a limited workspace team', async () => { + const email = createRandomEmail() + const domain = email.split('@')[1] + const user = await createTestUser({ + id: createRandomString(), + name: createRandomString(), + email, + role: Roles.Server.Admin, + verified: true + }) + const session = await login(user) + + const workspaceAdmin = await createTestUser({ + id: createRandomString(), + name: 'John Speckle', + email: createRandomEmail(), + role: Roles.Server.Admin, + verified: true, + avatar: 'data:image/png;base64,foobar' + }) + + await createTestWorkspace( + { + id: createRandomString(), + ownerId: workspaceAdmin.id, + name: 'Workspace A', + slug: cryptoRandomString({ length: 10 }), + discoverabilityEnabled: true + }, + workspaceAdmin, + { + domain + } + ) + await createTestWorkspace( + { + id: createRandomString(), + ownerId: workspaceAdmin.id, + name: 'Workspace B', + slug: cryptoRandomString({ length: 10 }), + discoverabilityEnabled: true + }, + workspaceAdmin, + { + domain + } + ) + // Workspace without domain should not be returned + await createTestWorkspace( + { + id: createRandomString(), + ownerId: workspaceAdmin.id, + name: 'Workspace C', + slug: cryptoRandomString({ length: 10 }) + }, + workspaceAdmin + ) + + const res = await session.execute( + GetActiveUserDiscoverableWorkspacesDocument, + {} + ) + expect(res).to.not.haveGraphQLErrors() + + expect(res.data?.activeUser?.discoverableWorkspaces).to.have.length(2) + const discoverableWorkspaces = res.data?.activeUser?.discoverableWorkspaces + expect(discoverableWorkspaces?.[0].team?.items).to.have.length(1) + expect(discoverableWorkspaces?.[0].team?.items[0].avatar).to.eq( + workspaceAdmin.avatar + ) + expect(discoverableWorkspaces?.[1].team?.items).to.have.length(1) + expect(discoverableWorkspaces?.[1].team?.items[0].avatar).to.eq( + workspaceAdmin.avatar + ) + }) + }) + describe('query activeUser.workspaces', () => { it('should return all workspaces for a user', async () => { const testUser: BasicTestUser = { diff --git a/packages/server/test/graphql/generated/graphql.ts b/packages/server/test/graphql/generated/graphql.ts index 8b2df4e9c..f5ceb015e 100644 --- a/packages/server/test/graphql/generated/graphql.ts +++ b/packages/server/test/graphql/generated/graphql.ts @@ -942,6 +942,18 @@ export type DiscoverableStreamsSortingInput = { type: DiscoverableStreamsSortType; }; +export type DiscoverableWorkspaceCollaborator = { + __typename?: 'DiscoverableWorkspaceCollaborator'; + avatar: Scalars['String']['output']; +}; + +export type DiscoverableWorkspaceCollaboratorCollection = { + __typename?: 'DiscoverableWorkspaceCollaboratorCollection'; + cursor?: Maybe; + items: Array; + totalCount: Scalars['Int']['output']; +}; + export type EditCommentInput = { commentId: Scalars['String']['input']; content: CommentContentInput; @@ -1155,6 +1167,15 @@ export type LimitedWorkspace = { name: Scalars['String']['output']; /** Unique workspace short id. Used for navigation. */ slug: Scalars['String']['output']; + /** Workspace members visible to people with verified email domain */ + team?: Maybe; +}; + + +/** Workspace metadata visible to non-workspace members. */ +export type LimitedWorkspaceTeamArgs = { + cursor?: InputMaybe; + limit?: Scalars['Int']['input']; }; export type LimitedWorkspaceJoinRequest = { @@ -5642,7 +5663,7 @@ export type GetWorkspaceBySlugQuery = { __typename?: 'Query', workspaceBySlug: { export type GetActiveUserDiscoverableWorkspacesQueryVariables = Exact<{ [key: string]: never; }>; -export type GetActiveUserDiscoverableWorkspacesQuery = { __typename?: 'Query', activeUser?: { __typename?: 'User', discoverableWorkspaces: Array<{ __typename?: 'LimitedWorkspace', id: string, name: string, description?: string | null }> } | null }; +export type GetActiveUserDiscoverableWorkspacesQuery = { __typename?: 'Query', activeUser?: { __typename?: 'User', discoverableWorkspaces: Array<{ __typename?: 'LimitedWorkspace', id: string, name: string, description?: string | null, team?: { __typename?: 'DiscoverableWorkspaceCollaboratorCollection', totalCount: number, cursor?: string | null, items: Array<{ __typename?: 'DiscoverableWorkspaceCollaborator', avatar: string }> } | null }> } | null }; export type UpdateWorkspaceMutationVariables = Exact<{ input: WorkspaceUpdateInput; @@ -5859,7 +5880,7 @@ export const CreateWorkspaceDocument = {"kind":"Document","definitions":[{"kind" export const DeleteWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"delete"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"workspaceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}]}]}}]}}]} as unknown as DocumentNode; export const GetWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspaceCollaborator"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceCollaborator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceCollaborator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"projectRoles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"project"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; export const GetWorkspaceBySlugDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceBySlug"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceSlug"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceBySlug"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceSlug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspace"}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspaceCollaborator"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceCollaborator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceCollaborator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"projectRoles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"project"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetActiveUserDiscoverableWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getActiveUserDiscoverableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"discoverableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetActiveUserDiscoverableWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"getActiveUserDiscoverableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"discoverableWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"avatar"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const UpdateWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceUpdateInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"update"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspace"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; export const GetActiveUserWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveUserWorkspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaces"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspace"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspace"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}},{"kind":"Field","name":{"kind":"Name","value":"readOnly"}}]}}]} as unknown as DocumentNode; export const UpdateWorkspaceRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateWorkspaceRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceRoleUpdateInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateRole"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"team"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspaceCollaborator"}}]}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceCollaborator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceCollaborator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"projectRoles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"project"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode; diff --git a/packages/server/test/graphql/workspaces.ts b/packages/server/test/graphql/workspaces.ts index 6fcceda74..a0840d567 100644 --- a/packages/server/test/graphql/workspaces.ts +++ b/packages/server/test/graphql/workspaces.ts @@ -99,6 +99,13 @@ export const getActiveUserDiscoverableWorkspacesQuery = gql` id name description + team { + items { + avatar + } + totalCount + cursor + } } } }