From b090637ce8987aaedbdfb637e328fd9f278f38d9 Mon Sep 17 00:00:00 2001 From: martmull Date: Thu, 8 Feb 2024 16:31:22 +0100 Subject: [PATCH] Remove useless query --- .../graphql/queries/getCurrentUserAndViews.ts | 103 ------------------ .../__stories__/CreateProfile.stories.tsx | 19 ++-- .../auth/__stories__/PlanRequired.stories.tsx | 27 ++--- .../auth/__stories__/SignInUp.stories.tsx | 19 ++-- .../twenty-front/src/testing/graphqlMocks.ts | 4 +- 5 files changed, 30 insertions(+), 142 deletions(-) delete mode 100644 packages/twenty-front/src/modules/users/graphql/queries/getCurrentUserAndViews.ts diff --git a/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUserAndViews.ts b/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUserAndViews.ts deleted file mode 100644 index 9b0da4252df..00000000000 --- a/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUserAndViews.ts +++ /dev/null @@ -1,103 +0,0 @@ -// This query cannot be put in the graphQL folder because it cannot be generated by the graphQL codegen. -import { gql } from '@apollo/client'; - -export const GET_CURRENT_USER_AND_VIEWS = gql` - query GetCurrentUserAndViews { - currentUser { - id - firstName - lastName - email - canImpersonate - supportUserHash - workspaceMember { - id - name { - firstName - lastName - } - colorScheme - avatarUrl - locale - } - defaultWorkspace { - id - displayName - logo - domainName - inviteHash - allowImpersonation - subscriptionStatus - featureFlags { - id - key - value - workspaceId - } - } - } - views { - pageInfo { - hasNextPage - hasPreviousPage - startCursor - endCursor - } - edges { - cursor - node { - id - createdAt - updatedAt - name - objectMetadataId - type - deletedAt - viewFilters { - edges { - cursor - node { - id - createdAt - updatedAt - fieldMetadataId - operand - value - displayValue - deletedAt - } - } - } - viewSorts { - edges { - cursor - node { - id - createdAt - updatedAt - fieldMetadataId - direction - deletedAt - } - } - } - viewFields { - edges { - cursor - node { - id - createdAt - updatedAt - fieldMetadataId - isVisible - size - position - deletedAt - } - } - } - } - } - } - } -`; diff --git a/packages/twenty-front/src/pages/auth/__stories__/CreateProfile.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/CreateProfile.stories.tsx index 953be52cde7..302883712f5 100644 --- a/packages/twenty-front/src/pages/auth/__stories__/CreateProfile.stories.tsx +++ b/packages/twenty-front/src/pages/auth/__stories__/CreateProfile.stories.tsx @@ -4,7 +4,7 @@ import { within } from '@storybook/test'; import { graphql, HttpResponse } from 'msw'; import { AppPath } from '@/types/AppPath'; -import { GET_CURRENT_USER_AND_VIEWS } from '@/users/graphql/queries/getCurrentUserAndViews'; +import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { PageDecorator, PageDecoratorArgs, @@ -22,16 +22,13 @@ const meta: Meta = { parameters: { msw: { handlers: [ - graphql.query( - getOperationName(GET_CURRENT_USER_AND_VIEWS) ?? '', - () => { - return HttpResponse.json({ - data: { - currentUser: mockedOnboardingUsersData[0], - }, - }); - }, - ), + graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => { + return HttpResponse.json({ + data: { + currentUser: mockedOnboardingUsersData[0], + }, + }); + }), graphqlMocks.handlers, ], }, diff --git a/packages/twenty-front/src/pages/auth/__stories__/PlanRequired.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/PlanRequired.stories.tsx index 7cfea3caefa..f325f824ca1 100644 --- a/packages/twenty-front/src/pages/auth/__stories__/PlanRequired.stories.tsx +++ b/packages/twenty-front/src/pages/auth/__stories__/PlanRequired.stories.tsx @@ -4,7 +4,7 @@ import { within } from '@storybook/test'; import { graphql, HttpResponse } from 'msw'; import { AppPath } from '@/types/AppPath'; -import { GET_CURRENT_USER_AND_VIEWS } from '@/users/graphql/queries/getCurrentUserAndViews'; +import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { PageDecorator, PageDecoratorArgs, @@ -22,22 +22,19 @@ const meta: Meta = { parameters: { msw: { handlers: [ - graphql.query( - getOperationName(GET_CURRENT_USER_AND_VIEWS) ?? '', - () => { - return HttpResponse.json({ - data: { - currentUser: { - ...mockedOnboardingUsersData[0], - defaultWorkspace: { - ...mockedOnboardingUsersData[0].defaultWorkspace, - subscriptionStatus: 'incomplete', - }, + graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => { + return HttpResponse.json({ + data: { + currentUser: { + ...mockedOnboardingUsersData[0], + defaultWorkspace: { + ...mockedOnboardingUsersData[0].defaultWorkspace, + subscriptionStatus: 'incomplete', }, }, - }); - }, - ), + }, + }); + }), graphqlMocks.handlers, ], }, diff --git a/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx index f9ce7546b0c..2c40e0359c7 100644 --- a/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx +++ b/packages/twenty-front/src/pages/auth/__stories__/SignInUp.stories.tsx @@ -4,7 +4,7 @@ import { fireEvent, within } from '@storybook/test'; import { graphql, HttpResponse } from 'msw'; import { AppPath } from '@/types/AppPath'; -import { GET_CURRENT_USER_AND_VIEWS } from '@/users/graphql/queries/getCurrentUserAndViews'; +import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { PageDecorator, PageDecoratorArgs, @@ -22,16 +22,13 @@ const meta: Meta = { parameters: { msw: { handlers: [ - graphql.query( - getOperationName(GET_CURRENT_USER_AND_VIEWS) ?? '', - () => { - return HttpResponse.json({ - data: { - currentUser: mockedOnboardingUsersData[0], - }, - }); - }, - ), + graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => { + return HttpResponse.json({ + data: { + currentUser: mockedOnboardingUsersData[0], + }, + }); + }), graphqlMocks.handlers, ], }, diff --git a/packages/twenty-front/src/testing/graphqlMocks.ts b/packages/twenty-front/src/testing/graphqlMocks.ts index 0a6e92dfa08..0f9fa442855 100644 --- a/packages/twenty-front/src/testing/graphqlMocks.ts +++ b/packages/twenty-front/src/testing/graphqlMocks.ts @@ -4,7 +4,7 @@ import { graphql, HttpResponse } from 'msw'; import { CREATE_EVENT } from '@/analytics/graphql/queries/createEvent'; import { GET_CLIENT_CONFIG } from '@/client-config/graphql/queries/getClientConfig'; import { FIND_MANY_OBJECT_METADATA_ITEMS } from '@/object-metadata/graphql/queries'; -import { GET_CURRENT_USER_AND_VIEWS } from '@/users/graphql/queries/getCurrentUserAndViews'; +import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser'; import { REACT_APP_SERVER_BASE_URL } from '~/config'; import { mockedActivities } from '~/testing/mock-data/activities'; import { mockedCompaniesData } from '~/testing/mock-data/companies'; @@ -22,7 +22,7 @@ const metadataGraphql = graphql.link(`${REACT_APP_SERVER_BASE_URL}/metadata`); export const graphqlMocks = { handlers: [ - graphql.query(getOperationName(GET_CURRENT_USER_AND_VIEWS) ?? '', () => { + graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => { return HttpResponse.json({ data: { currentUser: mockedUsersData[0],