feat(workspaces): leave workspace (#2585)

This commit is contained in:
Gergő Jedlicska
2024-08-06 16:55:40 +02:00
committed by GitHub
parent 72bc7357c5
commit 625fec4294
9 changed files with 177 additions and 3 deletions
@@ -238,3 +238,11 @@ extend type AdminQueries {
input UserWorkspacesFilter {
search: String
}
type UserWorkspaceMutations {
leave(id: ID!): Boolean!
}
extend type ActiveUserMutations {
workspaceMutations: UserWorkspaceMutations
}
+1
View File
@@ -25,6 +25,7 @@ generates:
User: '@/modules/core/helpers/graphTypes#UserGraphQLReturn'
ActiveUserMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
UserEmailMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
UserWorkspaceMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
ProjectMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
ProjectInviteMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
ModelMutations: '@/modules/core/helpers/graphTypes#MutationsObjectGraphQLReturn'
@@ -38,6 +38,7 @@ export type ActiveUserMutations = {
finishOnboarding: Scalars['Boolean']['output'];
/** Edit a user's profile */
update: User;
workspaceMutations?: Maybe<UserWorkspaceMutations>;
};
@@ -3576,6 +3577,16 @@ export type UserUpdateInput = {
name?: InputMaybe<Scalars['String']['input']>;
};
export type UserWorkspaceMutations = {
__typename?: 'UserWorkspaceMutations';
leave: Scalars['Boolean']['output'];
};
export type UserWorkspaceMutationsLeaveArgs = {
id: Scalars['ID']['input'];
};
export type UserWorkspacesFilter = {
search?: InputMaybe<Scalars['String']['input']>;
};
@@ -4230,6 +4241,7 @@ export type ResolversTypes = {
UserRoleInput: UserRoleInput;
UserSearchResultCollection: ResolverTypeWrapper<Omit<UserSearchResultCollection, 'items'> & { items: Array<ResolversTypes['LimitedUser']> }>;
UserUpdateInput: UserUpdateInput;
UserWorkspaceMutations: ResolverTypeWrapper<MutationsObjectGraphQLReturn>;
UserWorkspacesFilter: UserWorkspacesFilter;
Version: ResolverTypeWrapper<VersionGraphQLReturn>;
VersionCollection: ResolverTypeWrapper<Omit<VersionCollection, 'items'> & { items: Array<ResolversTypes['Version']> }>;
@@ -4453,6 +4465,7 @@ export type ResolversParentTypes = {
UserRoleInput: UserRoleInput;
UserSearchResultCollection: Omit<UserSearchResultCollection, 'items'> & { items: Array<ResolversParentTypes['LimitedUser']> };
UserUpdateInput: UserUpdateInput;
UserWorkspaceMutations: MutationsObjectGraphQLReturn;
UserWorkspacesFilter: UserWorkspacesFilter;
Version: VersionGraphQLReturn;
VersionCollection: Omit<VersionCollection, 'items'> & { items: Array<ResolversParentTypes['Version']> };
@@ -4524,6 +4537,7 @@ export type ActiveUserMutationsResolvers<ContextType = GraphQLContext, ParentTyp
emailMutations?: Resolver<ResolversTypes['UserEmailMutations'], ParentType, ContextType>;
finishOnboarding?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType>;
update?: Resolver<ResolversTypes['User'], ParentType, ContextType, RequireFields<ActiveUserMutationsUpdateArgs, 'user'>>;
workspaceMutations?: Resolver<Maybe<ResolversTypes['UserWorkspaceMutations']>, ParentType, ContextType>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
@@ -5691,6 +5705,11 @@ export type UserSearchResultCollectionResolvers<ContextType = GraphQLContext, Pa
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type UserWorkspaceMutationsResolvers<ContextType = GraphQLContext, ParentType extends ResolversParentTypes['UserWorkspaceMutations'] = ResolversParentTypes['UserWorkspaceMutations']> = {
leave?: Resolver<ResolversTypes['Boolean'], ParentType, ContextType, RequireFields<UserWorkspaceMutationsLeaveArgs, 'id'>>;
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
};
export type VersionResolvers<ContextType = GraphQLContext, ParentType extends ResolversParentTypes['Version'] = ResolversParentTypes['Version']> = {
authorUser?: Resolver<Maybe<ResolversTypes['LimitedUser']>, ParentType, ContextType>;
automationsStatus?: Resolver<Maybe<ResolversTypes['TriggeredAutomationsStatus']>, ParentType, ContextType>;
@@ -5957,6 +5976,7 @@ export type Resolvers<ContextType = GraphQLContext> = {
UserEmailMutations?: UserEmailMutationsResolvers<ContextType>;
UserProjectsUpdatedMessage?: UserProjectsUpdatedMessageResolvers<ContextType>;
UserSearchResultCollection?: UserSearchResultCollectionResolvers<ContextType>;
UserWorkspaceMutations?: UserWorkspaceMutationsResolvers<ContextType>;
Version?: VersionResolvers<ContextType>;
VersionCollection?: VersionCollectionResolvers<ContextType>;
VersionCreatedTrigger?: VersionCreatedTriggerResolvers<ContextType>;
@@ -27,6 +27,7 @@ export type ActiveUserMutations = {
finishOnboarding: Scalars['Boolean']['output'];
/** Edit a user's profile */
update: User;
workspaceMutations?: Maybe<UserWorkspaceMutations>;
};
@@ -3565,6 +3566,16 @@ export type UserUpdateInput = {
name?: InputMaybe<Scalars['String']['input']>;
};
export type UserWorkspaceMutations = {
__typename?: 'UserWorkspaceMutations';
leave: Scalars['Boolean']['output'];
};
export type UserWorkspaceMutationsLeaveArgs = {
id: Scalars['ID']['input'];
};
export type UserWorkspacesFilter = {
search?: InputMaybe<Scalars['String']['input']>;
};
@@ -514,6 +514,29 @@ export = FF_WORKSPACES_MODULE_ENABLED
workspaceList: async () => {
throw new WorkspacesNotYetImplementedError()
}
},
ActiveUserMutations: {
workspaceMutations: () => ({})
},
UserWorkspaceMutations: {
leave: async (parent, args, ctx) => {
const userId = ctx.userId!
const getWorkspaceRoles = getWorkspaceRolesFactory({ db })
const emitWorkspaceEvent = getEventBus().emit
const deleteWorkspaceRole = deleteWorkspaceRoleFactory({
deleteWorkspaceRole: repoDeleteWorkspaceRoleFactory({ db }),
getWorkspaceRoles,
emitWorkspaceEvent,
getStreams,
revokeStreamPermissions
})
await deleteWorkspaceRole({ workspaceId: args.id, userId })
return true
}
}
} as Resolvers)
: {}
@@ -15,7 +15,9 @@ import {
CreateWorkspaceDocument,
GetActiveUserWorkspacesDocument,
GetWorkspaceDocument,
UpdateWorkspaceDocument
UpdateWorkspaceDocument,
ActiveUserLeaveWorkspaceDocument,
UpdateWorkspaceRoleDocument
} from '@/test/graphql/generated/graphql'
import { Workspace } from '@/modules/workspacesCore/domain/types'
import { beforeEachContext } from '@/test/hooks'
@@ -35,9 +37,17 @@ describe('Workspaces GQL CRUD', () => {
role: Roles.Server.Admin
}
const userB: BasicTestUser = {
id: '',
name: 'Alice speckle',
email: 'alice-speckle@example.org',
role: Roles.Server.User
}
before(async () => {
await beforeEachContext()
await createTestUser(testUser)
await Promise.all([createTestUser(testUser), createTestUser(userB)])
const token = await createAuthTokenForUser(testUser.id, AllScopes)
apollo = await testApolloServer({
context: createTestContext({
@@ -179,5 +189,72 @@ describe('Workspaces GQL CRUD', () => {
expect(data?.workspace.description).to.equal('')
})
})
describe('mutation activeUserMutations.userWorkspaceMutations', () => {
describe('leave', () => {
it('allows the active user to leave a workspace', async () => {
const name = cryptoRandomString({ length: 6 })
const workspaceCreateResult = await apollo.execute(CreateWorkspaceDocument, {
input: { name }
})
const id = workspaceCreateResult.data?.workspaceMutations.create.id
if (!id) throw new Error('This should have succeeded')
await apollo.execute(UpdateWorkspaceRoleDocument, {
input: {
userId: userB.id,
workspaceId: id,
role: Roles.Workspace.Admin
}
})
let userWorkspaces = await apollo.execute(GetActiveUserWorkspacesDocument, {})
expect(
userWorkspaces.data?.activeUser?.workspaces.items
.map((i) => i.name)
.includes(name)
).to.be.true
const leaveResult = await apollo.execute(ActiveUserLeaveWorkspaceDocument, {
id
})
expect(leaveResult.errors).to.be.undefined
userWorkspaces = await apollo.execute(GetActiveUserWorkspacesDocument, {})
expect(
userWorkspaces.data?.activeUser?.workspaces.items
.map((i) => i.name)
.includes(name)
).to.be.false
})
it('stops the last workspace admin from leaving the workspace', async () => {
const name = cryptoRandomString({ length: 6 })
const workspaceCreateResult = await apollo.execute(CreateWorkspaceDocument, {
input: { name }
})
const id = workspaceCreateResult.data?.workspaceMutations.create.id
if (!id) throw new Error('This should have succeeded')
const leaveResult = await apollo.execute(ActiveUserLeaveWorkspaceDocument, {
id
})
expect(leaveResult.errors?.length).to.be.greaterThanOrEqual(1)
const userWorkspaces = await apollo.execute(
GetActiveUserWorkspacesDocument,
{}
)
expect(
userWorkspaces.data?.activeUser?.workspaces.items
.map((i) => i.name)
.includes(name)
).to.be.true
})
})
})
})
})
@@ -71,6 +71,11 @@ export = !FF_WORKSPACES_MODULE_ENABLED
workspaceList: async () => {
throw new WorkspacesModuleDisabledError()
}
},
ActiveUserMutations: {
workspaceMutations: async () => {
throw new WorkspacesModuleDisabledError()
}
}
} as Resolvers)
: {}
@@ -28,6 +28,7 @@ export type ActiveUserMutations = {
finishOnboarding: Scalars['Boolean']['output'];
/** Edit a user's profile */
update: User;
workspaceMutations?: Maybe<UserWorkspaceMutations>;
};
@@ -3566,6 +3567,16 @@ export type UserUpdateInput = {
name?: InputMaybe<Scalars['String']['input']>;
};
export type UserWorkspaceMutations = {
__typename?: 'UserWorkspaceMutations';
leave: Scalars['Boolean']['output'];
};
export type UserWorkspaceMutationsLeaveArgs = {
id: Scalars['ID']['input'];
};
export type UserWorkspacesFilter = {
search?: InputMaybe<Scalars['String']['input']>;
};
@@ -4568,6 +4579,13 @@ export type GetWorkspaceProjectsQueryVariables = Exact<{
export type GetWorkspaceProjectsQuery = { __typename?: 'Query', workspace: { __typename?: 'Workspace', projects: { __typename?: 'ProjectCollection', cursor?: string | null, totalCount: number, items: Array<{ __typename?: 'Project', id: string, name: string, createdAt: string, updatedAt: string }> } } };
export type ActiveUserLeaveWorkspaceMutationVariables = Exact<{
id: Scalars['ID']['input'];
}>;
export type ActiveUserLeaveWorkspaceMutation = { __typename?: 'Mutation', activeUserMutations: { __typename?: 'ActiveUserMutations', workspaceMutations?: { __typename?: 'UserWorkspaceMutations', leave: boolean } | null } };
export const BasicWorkspaceFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicWorkspace"},"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":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"role"}}]}}]} as unknown as DocumentNode<BasicWorkspaceFragment, unknown>;
export const BasicPendingWorkspaceCollaboratorFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicPendingWorkspaceCollaborator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PendingWorkspaceCollaborator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"inviteId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceId"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceName"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"invitedBy"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]} as unknown as DocumentNode<BasicPendingWorkspaceCollaboratorFragment, unknown>;
export const BasicStreamAccessRequestFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"BasicStreamAccessRequestFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StreamAccessRequest"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"requester"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"requesterId"}},{"kind":"Field","name":{"kind":"Name","value":"streamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]} as unknown as DocumentNode<BasicStreamAccessRequestFieldsFragment, unknown>;
@@ -4665,4 +4683,5 @@ export const UpdateWorkspaceDocument = {"kind":"Document","definitions":[{"kind"
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":"description"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"logo"}}]}}]} as unknown as DocumentNode<GetActiveUserWorkspacesQuery, GetActiveUserWorkspacesQueryVariables>;
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":"id"}},{"kind":"Field","name":{"kind":"Name","value":"role"}}]}}]}}]}}]}}]} as unknown as DocumentNode<UpdateWorkspaceRoleMutation, UpdateWorkspaceRoleMutationVariables>;
export const CreateWorkspaceProjectDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateWorkspaceProject"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectCreateInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projectMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"create"},"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":"TestWorkspaceProject"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceProject"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Project"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<CreateWorkspaceProjectMutation, CreateWorkspaceProjectMutationVariables>;
export const GetWorkspaceProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceProjects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceProjectsFilter"}}}],"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":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"cursor"},"value":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspaceProject"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceProject"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Project"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<GetWorkspaceProjectsQuery, GetWorkspaceProjectsQueryVariables>;
export const GetWorkspaceProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaceProjects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filter"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"WorkspaceProjectsFilter"}}}],"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":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}},{"kind":"Argument","name":{"kind":"Name","value":"cursor"},"value":{"kind":"Variable","name":{"kind":"Name","value":"cursor"}}},{"kind":"Argument","name":{"kind":"Name","value":"filter"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestWorkspaceProject"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cursor"}},{"kind":"Field","name":{"kind":"Name","value":"totalCount"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestWorkspaceProject"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Project"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}}]} as unknown as DocumentNode<GetWorkspaceProjectsQuery, GetWorkspaceProjectsQueryVariables>;
export const ActiveUserLeaveWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ActiveUserLeaveWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeUserMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaceMutations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"leave"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}]}}]}}]}}]} as unknown as DocumentNode<ActiveUserLeaveWorkspaceMutation, ActiveUserLeaveWorkspaceMutationVariables>;
@@ -118,3 +118,13 @@ export const getWorkspaceProjects = gql`
}
${workspaceProjectFragment}
`
export const leaveWorkspaceMutation = gql`
mutation ActiveUserLeaveWorkspace($id: ID!) {
activeUserMutations {
workspaceMutations {
leave(id: $id)
}
}
}
`