3628 timebox separate user creation from workspace creation (#3737)

* Remove workspace schema creation from signUp

* Set user workspaceMember nullable

* Remove workspace creation

* Handle null workspace in tokens

* Update onboarding status

* Generate types

* Move createWorkspace to workspace resolver

* Create workspace after signup

* Update createWorkspace return type

* Update createWorkspace return type

* Create core.workspace at signup

* WIP

* Fix create workspace

* Fix create workspace

* Clean code

* Remove useless recoil set

* Simplify create workspace request

* Set currentWorkspace at login

* Fix tests

* Create a recoil value for is workspaceSchema created

* Rename createWorkspace to createWorkspaceSchema

* Code review returns

* Use AppPath when possible

* Try without state

* Fix

* Fixes

* Rename createWorkspaceSchema to activateWorkspace

* Remove defaultAvatarUrl from user

* Add defaultAvatarUrl to core user

This reverts commit 1701c30eb18804558293cc42043aedf96ea888df.

* Add defaultAvatarUrl to core user

This reverts commit 1701c30eb18804558293cc42043aedf96ea888df.

* Fix ci

* Fix tests

* Fix storybook

* Fix test

* Remove useless query

* Fix test

* Fix test

* Fix mock data

* Fix test

* Clean Mock Requests

* Fix tentative

* Revert "Clean Mock Requests"

This reverts commit 8aa20a34363ffddfdee24f18fc80b27ea0ad5e1d.

* Fix

* Revert "Fix"

This reverts commit 2df7e9b6569b8bfb53f6a45391db725e28d16a18.

* Revert "Revert "Clean Mock Requests""

This reverts commit 3aefef8e9600d161434a047e845563d1b8e0692e.

* Revert "Fix tentative"

This reverts commit 13e7748d6f3b3858d30fb08adbc8ad347c5556ee.

* Update filename

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
martmull
2024-02-09 12:06:11 +01:00
committed by GitHub
parent 3fc18aeec1
commit 7425223f83
49 changed files with 769 additions and 355 deletions

View File

@ -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<PageDecoratorArgs> = {
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,
],
},

View File

@ -1,14 +1,18 @@
import { getOperationName } from '@apollo/client/utilities';
import { Meta, StoryObj } from '@storybook/react';
import { within } from '@storybook/test';
import { graphql, HttpResponse } from 'msw';
import { useSetRecoilState } from 'recoil';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { AppPath } from '@/types/AppPath';
import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import {
PageDecorator,
PageDecoratorArgs,
} from '~/testing/decorators/PageDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
import { mockedOnboardingUsersData } from '~/testing/mock-data/users';
import { CreateWorkspace } from '../CreateWorkspace';
@ -25,7 +29,18 @@ const meta: Meta<PageDecoratorArgs> = {
],
args: { routePath: AppPath.CreateWorkspace },
parameters: {
msw: graphqlMocks,
msw: {
handlers: [
graphql.query(getOperationName(GET_CURRENT_USER) ?? '', () => {
return HttpResponse.json({
data: {
currentUser: mockedOnboardingUsersData[1],
},
});
}),
graphqlMocks.handlers,
],
},
},
};

View File

@ -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<PageDecoratorArgs> = {
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,
],
},

View File

@ -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<PageDecoratorArgs> = {
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,
],
},