Skip to content

The open alternative to Salesforce, designed for AI.

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

martmull7425223f830a
diff --git a/packages/twenty-front/src/effect-components/PageChangeEffect.tsx b/packages/twenty-front/src/effect-components/PageChangeEffect.tsx
index 9a165f349f7..841e0b18ba5 100644
--- a/packages/twenty-front/src/effect-components/PageChangeEffect.tsx
+++ b/packages/twenty-front/src/effect-components/PageChangeEffect.tsx
@@ -88,7 +88,7 @@ export const PageChangeEffect = () => {
) {
navigate(AppPath.PlanRequired);
} else if (
- onboardingStatus === OnboardingStatus.OngoingWorkspaceCreation &&
+ onboardingStatus === OnboardingStatus.OngoingWorkspaceActivation &&
!isMatchingLocation(AppPath.CreateWorkspace)
) {
navigate(AppPath.CreateWorkspace);
@@ -101,7 +101,7 @@ export const PageChangeEffect = () => {
onboardingStatus === OnboardingStatus.Completed &&
isMatchingOnboardingRoute
) {
- navigate('/');
+ navigate(AppPath.Index);
} else if (isMatchingLocation(AppPath.Invite)) {
const inviteHash =
matchPath({ path: '/invite/:workspaceInviteHash' }, location.pathname)
diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx
index 616194ac8a5..2b2b4cb5342 100644
--- a/packages/twenty-front/src/generated/graphql.tsx
+++ b/packages/twenty-front/src/generated/graphql.tsx
@@ -19,6 +19,10 @@ export type Scalars = {
Upload: any;
};
+export type ActivateWorkspaceInput = {
+ displayName?: InputMaybe<Scalars['String']>;
+};
+
export type Analytics = {
__typename?: 'Analytics';
/** Boolean that confirms query was dispatched */
@@ -77,15 +81,6 @@ export type ClientConfig = {
telemetry: Telemetry;
};
-export type CreateOneRefreshTokenInput = {
- /** The record to create */
- refreshToken: CreateRefreshTokenInput;
-};
-
-export type CreateRefreshTokenInput = {
- expiresAt: Scalars['DateTime'];
-};
-
export type CursorPaging = {
/** Paginate after opaque cursor */
after?: InputMaybe<Scalars['ConnectionCursor']>;
@@ -223,6 +218,7 @@ export type LoginToken = {
export type Mutation = {
__typename?: 'Mutation';
+ activateWorkspace: Workspace;
challenge: LoginToken;
createEvent: Analytics;
createOneObject: Object;
@@ -247,6 +243,11 @@ export type Mutation = {
};
+export type MutationActivateWorkspaceArgs = {
+ data: ActivateWorkspaceInput;
+};
+
+
export type MutationChallengeArgs = {
email: Scalars['String'];
password: Scalars['String'];
@@ -259,11 +260,6 @@ export type MutationCreateEventArgs = {
};
-export type MutationCreateOneRefreshTokenArgs = {
- input: CreateOneRefreshTokenInput;
-};
-
-
export type MutationDeleteOneObjectArgs = {
input: DeleteOneObjectInput;
};
@@ -532,6 +528,7 @@ export type User = {
__typename?: 'User';
canImpersonate: Scalars['Boolean'];
createdAt: Scalars['DateTime'];
+ defaultAvatarUrl?: Maybe<Scalars['String']>;
defaultWorkspace: Workspace;
deletedAt?: Maybe<Scalars['DateTime']>;
disabled?: Maybe<Scalars['Boolean']>;
@@ -545,7 +542,7 @@ export type User = {
passwordResetTokenExpiresAt?: Maybe<Scalars['DateTime']>;
supportUserHash?: Maybe<Scalars['String']>;
updatedAt: Scalars['DateTime'];
- workspaceMember: WorkspaceMember;
+ workspaceMember?: Maybe<WorkspaceMember>;
};
export type UserEdge = {
@@ -778,7 +775,7 @@ export type ImpersonateMutationVariables = Exact<{
}>;
-export type ImpersonateMutation = { __typename?: 'Mutation', impersonate: { __typename?: 'Verify', user: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } }, tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
+export type ImpersonateMutation = { __typename?: 'Mutation', impersonate: { __typename?: 'Verify', user: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } }, tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
export type RenewTokenMutationVariables = Exact<{
refreshToken: Scalars['String'];
@@ -809,7 +806,7 @@ export type VerifyMutationVariables = Exact<{
}>;
-export type VerifyMutation = { __typename?: 'Mutation', verify: { __typename?: 'Verify', user: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } }, tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
+export type VerifyMutation = { __typename?: 'Mutation', verify: { __typename?: 'Verify', user: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } }, tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
export type CheckUserExistsQueryVariables = Exact<{
email: Scalars['String'];
@@ -846,7 +843,7 @@ export type UploadImageMutationVariables = Exact<{
export type UploadImageMutation = { __typename?: 'Mutation', uploadImage: string };
-export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } };
+export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } };
export type DeleteUserAccountMutationVariables = Exact<{ [key: string]: never; }>;
@@ -860,6 +857,18 @@ export type UploadProfilePictureMutationVariables = Exact<{
export type UploadProfilePictureMutation = { __typename?: 'Mutation', uploadProfilePicture: string };
+export type GetCurrentUserQueryVariables = Exact<{ [key: string]: never; }>;
+
+
+export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, defaultWorkspace: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: string, key: string, value: boolean, workspaceId: string }> | null } } };
+
+export type ActivateWorkspaceMutationVariables = Exact<{
+ input: ActivateWorkspaceInput;
+}>;
+
+
+export type ActivateWorkspaceMutation = { __typename?: 'Mutation', activateWorkspace: { __typename?: 'Workspace', id: string } };
+
export type DeleteCurrentWorkspaceMutationVariables = Exact<{ [key: string]: never; }>;
@@ -1677,6 +1686,103 @@ export function useUploadProfilePictureMutation(baseOptions?: Apollo.MutationHoo
export type UploadProfilePictureMutationHookResult = ReturnType<typeof useUploadProfilePictureMutation>;
export type UploadProfilePictureMutationResult = Apollo.MutationResult<UploadProfilePictureMutation>;
export type UploadProfilePictureMutationOptions = Apollo.BaseMutationOptions<UploadProfilePictureMutation, UploadProfilePictureMutationVariables>;
+export const GetCurrentUserDocument = gql`
+ query GetCurrentUser {
+ 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
+ }
+ }
+ }
+}
+ `;
+
+/**
+ * __useGetCurrentUserQuery__
+ *
+ * To run a query within a React component, call `useGetCurrentUserQuery` and pass it any options that fit your needs.
+ * When your component renders, `useGetCurrentUserQuery` returns an object from Apollo Client that contains loading, error, and data properties
+ * you can use to render your UI.
+ *
+ * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
+ *
+ * @example
+ * const { data, loading, error } = useGetCurrentUserQuery({
+ * variables: {
+ * },
+ * });
+ */
+export function useGetCurrentUserQuery(baseOptions?: Apollo.QueryHookOptions<GetCurrentUserQuery, GetCurrentUserQueryVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useQuery<GetCurrentUserQuery, GetCurrentUserQueryVariables>(GetCurrentUserDocument, options);
+ }
+export function useGetCurrentUserLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetCurrentUserQuery, GetCurrentUserQueryVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useLazyQuery<GetCurrentUserQuery, GetCurrentUserQueryVariables>(GetCurrentUserDocument, options);
+ }
+export type GetCurrentUserQueryHookResult = ReturnType<typeof useGetCurrentUserQuery>;
+export type GetCurrentUserLazyQueryHookResult = ReturnType<typeof useGetCurrentUserLazyQuery>;
+export type GetCurrentUserQueryResult = Apollo.QueryResult<GetCurrentUserQuery, GetCurrentUserQueryVariables>;
+export const ActivateWorkspaceDocument = gql`
+ mutation ActivateWorkspace($input: ActivateWorkspaceInput!) {
+ activateWorkspace(data: $input) {
+ id
+ }
+}
+ `;
+export type ActivateWorkspaceMutationFn = Apollo.MutationFunction<ActivateWorkspaceMutation, ActivateWorkspaceMutationVariables>;
+
+/**
+ * __useActivateWorkspaceMutation__
+ *
+ * To run a mutation, you first call `useActivateWorkspaceMutation` within a React component and pass it any options that fit your needs.
+ * When your component renders, `useActivateWorkspaceMutation` returns a tuple that includes:
+ * - A mutate function that you can call at any time to execute the mutation
+ * - An object with fields that represent the current status of the mutation's execution
+ *
+ * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
+ *
+ * @example
+ * const [activateWorkspaceMutation, { data, loading, error }] = useActivateWorkspaceMutation({
+ * variables: {
+ * input: // value for 'input'
+ * },
+ * });
+ */
+export function useActivateWorkspaceMutation(baseOptions?: Apollo.MutationHookOptions<ActivateWorkspaceMutation, ActivateWorkspaceMutationVariables>) {
+ const options = {...defaultOptions, ...baseOptions}
+ return Apollo.useMutation<ActivateWorkspaceMutation, ActivateWorkspaceMutationVariables>(ActivateWorkspaceDocument, options);
+ }
+export type ActivateWorkspaceMutationHookResult = ReturnType<typeof useActivateWorkspaceMutation>;
+export type ActivateWorkspaceMutationResult = Apollo.MutationResult<ActivateWorkspaceMutation>;
+export type ActivateWorkspaceMutationOptions = Apollo.BaseMutationOptions<ActivateWorkspaceMutation, ActivateWorkspaceMutationVariables>;
export const DeleteCurrentWorkspaceDocument = gql`
mutation DeleteCurrentWorkspace {
deleteCurrentWorkspace {
diff --git a/packages/twenty-front/src/modules/auth/hooks/__test__/useOnboardingStatus.test.ts b/packages/twenty-front/src/modules/auth/hooks/__test__/useOnboardingStatus.test.ts
index 14349aaad05..94f643840bc 100644
--- a/packages/twenty-front/src/modules/auth/hooks/__test__/useOnboardingStatus.test.ts
+++ b/packages/twenty-front/src/modules/auth/hooks/__test__/useOnboardingStatus.test.ts
@@ -66,16 +66,6 @@ describe('useOnboardingStatus', () => {
expect(result.current.onboardingStatus).toBe('ongoing_user_creation');
});
- it('should return undefined when currentWorkspaceMember in undefined', async () => {
- const { result } = renderHooks();
-
- act(() => {
- result.current.setTokenPair(tokenPair);
- });
-
- expect(result.current.onboardingStatus).toBe(undefined);
- });
-
it('should return "incomplete"', async () => {
const { result } = renderHooks();
const {
@@ -120,14 +110,9 @@ describe('useOnboardingStatus', () => {
expect(result.current.onboardingStatus).toBe('canceled');
});
- it('should return "ongoing_workspace_creation"', async () => {
+ it('should return "ongoing_workspace_activation"', async () => {
const { result } = renderHooks();
- const {
- setTokenPair,
- setBilling,
- setCurrentWorkspace,
- setCurrentWorkspaceMember,
- } = result.current;
+ const { setTokenPair, setBilling, setCurrentWorkspace } = result.current;
act(() => {
setTokenPair(tokenPair);
@@ -135,12 +120,31 @@ describe('useOnboardingStatus', () => {
setCurrentWorkspace({
...currentWorkspace,
displayName: '',
- subscriptionStatus: 'completed',
+ subscriptionStatus: 'active',
+ });
+ });
+
+ expect(result.current.onboardingStatus).toBe(
+ 'ongoing_workspace_activation',
+ );
+ });
+
+ it('should return "ongoing_workspace_activation"', async () => {
+ const { result } = renderHooks();
+ const { setTokenPair, setBilling, setCurrentWorkspace } = result.current;
+
+ act(() => {
+ setTokenPair(tokenPair);
+ setBilling(billing);
+ setCurrentWorkspace({
+ ...currentWorkspace,
+ subscriptionStatus: 'active',
});
- setCurrentWorkspaceMember(currentWorkspaceMember);
});
- expect(result.current.onboardingStatus).toBe('ongoing_workspace_creation');
+ expect(result.current.onboardingStatus).toBe(
+ 'ongoing_workspace_activation',
+ );
});
it('should return "ongoing_profile_creation"', async () => {
@@ -157,7 +161,7 @@ describe('useOnboardingStatus', () => {
setBilling(billing);
setCurrentWorkspace({
...currentWorkspace,
- subscriptionStatus: 'completed',
+ subscriptionStatus: 'active',
});
setCurrentWorkspaceMember(currentWorkspaceMember);
});
@@ -179,7 +183,7 @@ describe('useOnboardingStatus', () => {
setBilling(billing);
setCurrentWorkspace({
...currentWorkspace,
- subscriptionStatus: 'completed',
+ subscriptionStatus: 'active',
});
setCurrentWorkspaceMember({
...currentWorkspaceMember,
diff --git a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
index 36ff7c3aa3c..33c1170d855 100644
--- a/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
+++ b/packages/twenty-front/src/modules/auth/hooks/useAuth.ts
@@ -89,13 +89,16 @@ export const useAuth = () => {
setTokenPair(verifyResult.data?.verify.tokens);
const user = verifyResult.data?.verify.user;
- const workspaceMember = {
- ...user.workspaceMember,
- colorScheme: user.workspaceMember?.colorScheme as ColorScheme,
- };
- const workspace = user.defaultWorkspace ?? null;
+ let workspaceMember = null;
setCurrentUser(user);
- setCurrentWorkspaceMember(workspaceMember);
+ if (user.workspaceMember) {
+ workspaceMember = {
+ ...user.workspaceMember,
+ colorScheme: user.workspaceMember?.colorScheme as ColorScheme,
+ };
+ setCurrentWorkspaceMember(workspaceMember);
+ }
+ const workspace = user.defaultWorkspace ?? null;
setCurrentWorkspace(workspace);
return {
user,
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.tsx
index a2192f77691..75fa7376875 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSignInUp.tsx
@@ -143,16 +143,15 @@ export const useSignInUp = () => {
billing?.isBillingEnabled &&
currentWorkspace.subscriptionStatus !== 'active'
) {
- navigate('/plan-required');
+ navigate(AppPath.PlanRequired);
return;
}
-
if (currentWorkspace.displayName) {
- navigate('/');
+ navigate(AppPath.Index);
return;
}
- navigate('/create/workspace');
+ navigate(AppPath.CreateWorkspace);
} catch (err: any) {
enqueueSnackBar(err?.message, {
variant: 'error',
diff --git a/packages/twenty-front/src/modules/auth/states/selectors/isCurrentWorkspaceActiveSelector.ts b/packages/twenty-front/src/modules/auth/states/selectors/isCurrentWorkspaceActiveSelector.ts
new file mode 100644
index 00000000000..22c7fc605cc
--- /dev/null
+++ b/packages/twenty-front/src/modules/auth/states/selectors/isCurrentWorkspaceActiveSelector.ts
@@ -0,0 +1,11 @@
+import { selector } from 'recoil';
+
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
+
+export const isCurrentWorkspaceActiveSelector = selector({
+ key: 'isCurrentWorkspaceActiveSelector',
+ get: ({ get }) => {
+ const currentWorkspaceMember = get(currentWorkspaceMemberState);
+ return !!currentWorkspaceMember;
+ },
+});
diff --git a/packages/twenty-front/src/modules/auth/utils/__test__/getOnboardingStatus.test.ts b/packages/twenty-front/src/modules/auth/utils/__test__/getOnboardingStatus.test.ts
index b71e5a24893..2ca817cf587 100644
--- a/packages/twenty-front/src/modules/auth/utils/__test__/getOnboardingStatus.test.ts
+++ b/packages/twenty-front/src/modules/auth/utils/__test__/getOnboardingStatus.test.ts
@@ -11,24 +11,21 @@ describe('getOnboardingStatus', () => {
currentWorkspace: null,
});
- const unknownStatus = getOnboardingStatus({
+ const ongoingWorkspaceActivation = getOnboardingStatus({
isLoggedIn: true,
currentWorkspaceMember: null,
- currentWorkspace: null,
+ currentWorkspace: {
+ id: '1',
+ displayName: null,
+ } as CurrentWorkspace,
});
- const ongoingWorkspaceCreation = getOnboardingStatus({
+ const ongoingWorkspaceActivationPreviouslyActive = getOnboardingStatus({
isLoggedIn: true,
- currentWorkspaceMember: {
- id: '1',
- name: {
- firstName: 'John',
- lastName: 'Doe',
- },
- } as WorkspaceMember,
+ currentWorkspaceMember: null,
currentWorkspace: {
id: '1',
- displayName: null,
+ displayName: 'My Workspace',
} as CurrentWorkspace,
});
@@ -110,8 +107,10 @@ describe('getOnboardingStatus', () => {
});
expect(ongoingUserCreation).toBe('ongoing_user_creation');
- expect(unknownStatus).toBe(undefined);
- expect(ongoingWorkspaceCreation).toBe('ongoing_workspace_creation');
+ expect(ongoingWorkspaceActivation).toBe('ongoing_workspace_activation');
+ expect(ongoingWorkspaceActivationPreviouslyActive).toBe(
+ 'ongoing_workspace_activation',
+ );
expect(ongoingProfileCreation).toBe('ongoing_profile_creation');
expect(completed).toBe('completed');
expect(incomplete).toBe('incomplete');
diff --git a/packages/twenty-front/src/modules/auth/utils/getOnboardingStatus.ts b/packages/twenty-front/src/modules/auth/utils/getOnboardingStatus.ts
index e99e0cc7b02..78d86a94b79 100644
--- a/packages/twenty-front/src/modules/auth/utils/getOnboardingStatus.ts
+++ b/packages/twenty-front/src/modules/auth/utils/getOnboardingStatus.ts
@@ -5,7 +5,7 @@ export enum OnboardingStatus {
Incomplete = 'incomplete',
Canceled = 'canceled',
OngoingUserCreation = 'ongoing_user_creation',
- OngoingWorkspaceCreation = 'ongoing_workspace_creation',
+ OngoingWorkspaceActivation = 'ongoing_workspace_activation',
OngoingProfileCreation = 'ongoing_profile_creation',
Completed = 'completed',
}
@@ -28,11 +28,6 @@ export const getOnboardingStatus = ({
return OnboardingStatus.OngoingUserCreation;
}
- // if the user has not been fetched yet, we can't know the onboarding status
- if (!currentWorkspaceMember) {
- return undefined;
- }
-
if (
isBillingEnabled &&
currentWorkspace?.subscriptionStatus === 'incomplete'
@@ -44,9 +39,10 @@ export const getOnboardingStatus = ({
return OnboardingStatus.Canceled;
}
- if (!currentWorkspace?.displayName) {
- return OnboardingStatus.OngoingWorkspaceCreation;
+ if (!currentWorkspaceMember) {
+ return OnboardingStatus.OngoingWorkspaceActivation;
}
+
if (
!currentWorkspaceMember.name.firstName ||
!currentWorkspaceMember.name.lastName
diff --git a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
index 23c9740d7c6..6515a08af2a 100644
--- a/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/__stories__/CommandMenu.stories.tsx
@@ -3,6 +3,7 @@ import { Meta, StoryObj } from '@storybook/react';
import { expect, userEvent, within } from '@storybook/test';
import { useSetRecoilState } from 'recoil';
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { CommandType } from '@/command-menu/types/Command';
@@ -11,7 +12,10 @@ import { ComponentWithRouterDecorator } from '~/testing/decorators/ComponentWith
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
-import { mockDefaultWorkspace } from '~/testing/mock-data/users';
+import {
+ mockDefaultWorkspace,
+ mockedWorkspaceMemberData,
+} from '~/testing/mock-data/users';
import { sleep } from '~/testing/sleep';
import { CommandMenu } from '../CommandMenu';
@@ -24,10 +28,14 @@ const meta: Meta<typeof CommandMenu> = {
decorators: [
(Story) => {
const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
+ const setCurrentWorkspaceMember = useSetRecoilState(
+ currentWorkspaceMemberState,
+ );
const { addToCommandMenu, setToIntitialCommandMenu, openCommandMenu } =
useCommandMenu();
setCurrentWorkspace(mockDefaultWorkspace);
+ setCurrentWorkspaceMember(mockedWorkspaceMemberData);
useEffect(() => {
setToIntitialCommandMenu();
diff --git a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx
index bff05d9dce6..3680415ba45 100644
--- a/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/MobileNavigationBar.tsx
@@ -3,6 +3,7 @@ import { useRecoilState } from 'recoil';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
import { isCommandMenuOpenedState } from '@/command-menu/states/isCommandMenuOpenedState';
+import { AppPath } from '@/types/AppPath';
import {
IconCheckbox,
IconList,
@@ -71,7 +72,7 @@ export const MobileNavigationBar = () => {
onClick: () => {
closeCommandMenu();
setIsNavigationDrawerOpen(false);
- navigate('/tasks');
+ navigate(AppPath.TasksPage);
},
},
{
diff --git a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx
index 5b40a9e7ff0..3b4db3dce92 100644
--- a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx
+++ b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataItemsProvider.tsx
@@ -1,6 +1,6 @@
import { useRecoilValue } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { ObjectMetadataItemsLoadEffect } from '@/object-metadata/components/ObjectMetadataItemsLoadEffect';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
import { RelationPickerScope } from '@/object-record/relation-picker/scopes/RelationPickerScope';
@@ -9,12 +9,14 @@ export const ObjectMetadataItemsProvider = ({
children,
}: React.PropsWithChildren) => {
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
return (
<>
<ObjectMetadataItemsLoadEffect />
- {(!currentWorkspace || !!objectMetadataItems.length) && (
+ {(!isCurrentWorkspaceActive || !!objectMetadataItems.length) && (
<RelationPickerScope relationPickerScopeId="relation-picker">
{children}
</RelationPickerScope>
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
index 9853480d9e8..93286d9c500 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
@@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
import { useRecoilValue } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { ObjectMetadataItemNotFoundError } from '@/object-metadata/errors/ObjectMetadataNotFoundError';
import { useGetObjectOrderByField } from '@/object-metadata/hooks/useGetObjectOrderByField';
import { useMapToObjectRecordIdentifier } from '@/object-metadata/hooks/useMapToObjectRecordIdentifier';
@@ -40,7 +40,9 @@ export const useObjectMetadataItem = (
{ objectNameSingular }: ObjectMetadataItemIdentifier,
depth?: number,
) => {
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
const mockObjectMetadataItems = getObjectMetadataItemsMock();
let objectMetadataItem = useRecoilValue(
@@ -52,7 +54,7 @@ export const useObjectMetadataItem = (
let objectMetadataItems = useRecoilValue(objectMetadataItemsState);
- if (!currentWorkspace) {
+ if (!isCurrentWorkspaceActive) {
objectMetadataItem =
mockObjectMetadataItems.find(
(objectMetadataItem) =>
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemOnly.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemOnly.ts
index 4a32ee42565..61ade984cd2 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemOnly.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItemOnly.ts
@@ -1,6 +1,6 @@
import { useRecoilValue } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { ObjectMetadataItemNotFoundError } from '@/object-metadata/errors/ObjectMetadataNotFoundError';
import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
@@ -12,7 +12,9 @@ import { ObjectMetadataItemIdentifier } from '../types/ObjectMetadataItemIdentif
export const useObjectMetadataItemOnly = ({
objectNameSingular,
}: ObjectMetadataItemIdentifier) => {
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
const mockObjectMetadataItems = getObjectMetadataItemsMock();
let objectMetadataItem = useRecoilValue(
@@ -24,7 +26,7 @@ export const useObjectMetadataItemOnly = ({
let objectMetadataItems = useRecoilValue(objectMetadataItemsState);
- if (!currentWorkspace) {
+ if (!isCurrentWorkspaceActive) {
objectMetadataItem =
mockObjectMetadataItems.find(
(objectMetadataItem) =>
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts
index 470664a9112..aefce4f1f12 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNamePluralFromSingular.ts
@@ -1,6 +1,6 @@
import { useRecoilValue } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
import { getObjectMetadataItemsMock } from '@/object-metadata/utils/getObjectMetadataItemsMock';
import { isDefined } from '~/utils/isDefined';
@@ -10,7 +10,9 @@ export const useObjectNamePluralFromSingular = ({
}: {
objectNameSingular: string;
}) => {
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
const mockObjectMetadataItems = getObjectMetadataItemsMock();
let objectMetadataItem = useRecoilValue(
@@ -20,7 +22,7 @@ export const useObjectNamePluralFromSingular = ({
}),
);
- if (!currentWorkspace) {
+ if (!isCurrentWorkspaceActive) {
objectMetadataItem =
mockObjectMetadataItems.find(
(objectMetadataItem) =>
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts
index 2c9d0c1f60c..5fc5ee73d81 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectNameSingularFromPlural.ts
@@ -1,6 +1,6 @@
import { useRecoilValue } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
import { getObjectMetadataItemsMock } from '@/object-metadata/utils/getObjectMetadataItemsMock';
import { isDefined } from '~/utils/isDefined';
@@ -10,7 +10,9 @@ export const useObjectNameSingularFromPlural = ({
}: {
objectNamePlural: string;
}) => {
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
const mockObjectMetadataItems = getObjectMetadataItemsMock();
let objectMetadataItem = useRecoilValue(
@@ -20,7 +22,7 @@ export const useObjectNameSingularFromPlural = ({
}),
);
- if (!currentWorkspace) {
+ if (!isCurrentWorkspaceActive) {
objectMetadataItem =
mockObjectMetadataItems.find(
(objectMetadataItem) =>
diff --git a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useFindManyRecords.test.tsx b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useFindManyRecords.test.tsx
index 240f052209a..09d9a4a688a 100644
--- a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useFindManyRecords.test.tsx
+++ b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useFindManyRecords.test.tsx
@@ -3,7 +3,7 @@ import { MockedProvider } from '@apollo/client/testing';
import { renderHook } from '@testing-library/react';
import { RecoilRoot, useSetRecoilState } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
import { getObjectMetadataItemsMock } from '@/object-metadata/utils/getObjectMetadataItemsMock';
import {
@@ -39,7 +39,7 @@ const Wrapper = ({ children }: { children: ReactNode }) => (
);
describe('useFindManyRecords', () => {
- it('should skip fetch if currentWorkspace is undefined', async () => {
+ it('should skip fetch if currentWorkspaceMember is undefined', async () => {
const { result } = renderHook(
() => useFindManyRecords({ objectNameSingular: 'person' }),
{
@@ -56,12 +56,12 @@ describe('useFindManyRecords', () => {
const { result } = renderHook(
() => {
- const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
- setCurrentWorkspace({
+ const setCurrentWorkspaceMember = useSetRecoilState(
+ currentWorkspaceMemberState,
+ );
+ setCurrentWorkspaceMember({
id: '32219445-f587-4c40-b2b1-6d3205ed96da',
- displayName: 'cool-workspace',
- allowImpersonation: false,
- subscriptionStatus: 'incomplete',
+ name: { firstName: 'John', lastName: 'Connor' },
});
const mockObjectMetadataItems = getObjectMetadataItemsMock();
diff --git a/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts b/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts
index 90936b8b6ae..efadecedc84 100644
--- a/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts
+++ b/packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts
@@ -4,7 +4,7 @@ import { isNonEmptyArray } from '@apollo/client/utilities';
import { isNonEmptyString } from '@sniptt/guards';
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { ObjectMetadataItemIdentifier } from '@/object-metadata/types/ObjectMetadataItemIdentifier';
import { useMapConnectionToRecords } from '@/object-record/hooks/useMapConnectionToRecords';
@@ -65,12 +65,12 @@ export const useFindManyRecords = <T extends ObjectRecord = ObjectRecord>({
);
const { enqueueSnackBar } = useSnackBar();
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const currentWorkspaceMember = useRecoilValue(currentWorkspaceMemberState);
const { data, loading, error, fetchMore } = useQuery<
ObjectRecordQueryResult<T>
>(findManyRecordsQuery, {
- skip: skip || !objectMetadataItem || !currentWorkspace,
+ skip: skip || !objectMetadataItem || !currentWorkspaceMember,
variables: {
filter,
limit,
diff --git a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFieldInput.stories.tsx
index 710fe3e3fd9..76907469027 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/meta-types/input/components/__stories__/RelationFieldInput.stories.tsx
@@ -10,6 +10,7 @@ import {
} from '@storybook/test';
import { useSetRecoilState } from 'recoil';
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { useSetHotkeyScope } from '@/ui/utilities/hotkey/hooks/useSetHotkeyScope';
@@ -17,7 +18,10 @@ import { ComponentWithRecoilScopeDecorator } from '~/testing/decorators/Componen
import { ObjectMetadataItemsDecorator } from '~/testing/decorators/ObjectMetadataItemsDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { graphqlMocks } from '~/testing/graphqlMocks';
-import { mockDefaultWorkspace } from '~/testing/mock-data/users';
+import {
+ mockDefaultWorkspace,
+ mockedWorkspaceMemberData,
+} from '~/testing/mock-data/users';
import { FieldContextProvider } from '../../../__stories__/FieldContextProvider';
import {
@@ -27,10 +31,14 @@ import {
const RelationWorkspaceSetterEffect = () => {
const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
+ const setCurrentWorkspaceMember = useSetRecoilState(
+ currentWorkspaceMemberState,
+ );
useEffect(() => {
setCurrentWorkspace(mockDefaultWorkspace);
- }, [setCurrentWorkspace]);
+ setCurrentWorkspaceMember(mockedWorkspaceMemberData);
+ }, [setCurrentWorkspace, setCurrentWorkspaceMember]);
return <></>;
};
diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexTable.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexTable.ts
index cbbe331295e..8e3947b7dc3 100644
--- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexTable.ts
+++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexTable.ts
@@ -1,6 +1,6 @@
import { useRecoilValue, useSetRecoilState } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { isCurrentWorkspaceActiveSelector } from '@/auth/states/selectors/isCurrentWorkspaceActiveSelector';
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
import { turnObjectDropdownFilterIntoQueryFilter } from '@/object-record/record-filter/utils/turnObjectDropdownFilterIntoQueryFilter';
@@ -13,8 +13,10 @@ import { useFindManyRecords } from '../../hooks/useFindManyRecords';
export const useLoadRecordIndexTable = (objectNameSingular: string) => {
const { setRecordTableData, setIsRecordTableInitialLoading } =
useRecordTable();
- const currentWorkspace = useRecoilValue(currentWorkspaceState);
+ const isCurrentWorkspaceActive = useRecoilValue(
+ isCurrentWorkspaceActiveSelector,
+ );
const { objectMetadataItem } = useObjectMetadataItem({
objectNameSingular,
});
@@ -51,7 +53,7 @@ export const useLoadRecordIndexTable = (objectNameSingular: string) => {
});
return {
- records: currentWorkspace ? records : signInBackgroundMockCompanies,
+ records: isCurrentWorkspaceActive ? records : signInBackgroundMockCompanies,
loading,
fetchMoreRecords,
queryStateIdentifier,
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/states/isCreateModeScopedState.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/states/isCreateModeScopedState.ts
deleted file mode 100644
index 688d22ccfbe..00000000000
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-cell/states/isCreateModeScopedState.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { atomFamily } from 'recoil';
-
-export const isCreateModeScopedState = atomFamily<boolean, string>({
- key: 'isCreateModeScopedState',
- default: false,
-});
diff --git a/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchEntityQuery.test.tsx b/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchEntityQuery.test.tsx
index b562b7468de..57a93cdec66 100644
--- a/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchEntityQuery.test.tsx
+++ b/packages/twenty-front/src/modules/search/hooks/__tests__/useFilteredSearchEntityQuery.test.tsx
@@ -3,7 +3,7 @@ import { MockedProvider } from '@apollo/client/testing';
import { renderHook } from '@testing-library/react';
import { RecoilRoot, useSetRecoilState } from 'recoil';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
+import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
import { getObjectMetadataItemsMock } from '@/object-metadata/utils/getObjectMetadataItemsMock';
import { EntitiesForMultipleEntitySelect } from '@/object-record/relation-picker/types/EntitiesForMultipleEntitySelect';
@@ -66,12 +66,12 @@ describe('useFilteredSearchEntityQuery', () => {
it('returns the correct result when everything is provided', async () => {
const { result } = renderHook(
() => {
- const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
- setCurrentWorkspace({
+ const setCurrentWorkspaceMember = useSetRecoilState(
+ currentWorkspaceMemberState,
+ );
+ setCurrentWorkspaceMember({
id: '32219445-f587-4c40-b2b1-6d3205ed96da',
- displayName: 'cool-workspace',
- allowImpersonation: false,
- subscriptionStatus: 'incomplete',
+ name: { firstName: 'John', lastName: 'Connor' },
});
const mockObjectMetadataItems = getObjectMetadataItemsMock();
diff --git a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx
index 8f851546cbf..2d9c93baa99 100644
--- a/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx
+++ b/packages/twenty-front/src/modules/sign-in-background-mock/components/SignInBackgroundMockContainerEffect.tsx
@@ -28,7 +28,6 @@ export const SignInBackgroundMockContainerEffect = ({
const {
setAvailableTableColumns,
setOnEntityCountChange,
- setRecordTableData,
setTableColumns,
resetTableRowSelection,
} = useRecordTable({
@@ -77,7 +76,6 @@ export const SignInBackgroundMockContainerEffect = ({
setAvailableFieldDefinitions,
objectMetadataItem,
setAvailableTableColumns,
- setRecordTableData,
setTableColumns,
]);
diff --git a/packages/twenty-front/src/modules/users/components/UserProvider.tsx b/packages/twenty-front/src/modules/users/components/UserProvider.tsx
index fc39fe6e1b6..7bb02561eb5 100644
--- a/packages/twenty-front/src/modules/users/components/UserProvider.tsx
+++ b/packages/twenty-front/src/modules/users/components/UserProvider.tsx
@@ -5,7 +5,7 @@ import { useSetRecoilState } from 'recoil';
import { currentUserState } from '@/auth/states/currentUserState';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { GET_CURRENT_USER_AND_VIEWS } from '@/users/graphql/queries/getCurrentUserAndViews';
+import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
import { ColorScheme } from '@/workspace-member/types/WorkspaceMember';
export const UserProvider = ({ children }: React.PropsWithChildren) => {
@@ -13,21 +13,22 @@ export const UserProvider = ({ children }: React.PropsWithChildren) => {
const setCurrentUser = useSetRecoilState(currentUserState);
const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
+
const setCurrentWorkspaceMember = useSetRecoilState(
currentWorkspaceMemberState,
);
- const { loading: queryLoading, data: queryData } = useQuery(
- GET_CURRENT_USER_AND_VIEWS,
- );
+ const { loading: queryLoading, data: queryData } = useQuery(GET_CURRENT_USER);
useEffect(() => {
if (!queryLoading) {
setIsLoading(false);
}
- if (queryData?.currentUser?.workspaceMember) {
+ if (queryData?.currentUser) {
setCurrentUser(queryData.currentUser);
setCurrentWorkspace(queryData.currentUser.defaultWorkspace);
+ }
+ if (queryData?.currentUser?.workspaceMember) {
const workspaceMember = queryData.currentUser.workspaceMember;
setCurrentWorkspaceMember({
...workspaceMember,
diff --git a/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUser.ts b/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUser.ts
new file mode 100644
index 00000000000..d7bfacf245a
--- /dev/null
+++ b/packages/twenty-front/src/modules/users/graphql/queries/getCurrentUser.ts
@@ -0,0 +1,40 @@
+// 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 = gql`
+ query GetCurrentUser {
+ 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
+ }
+ }
+ }
+ }
+`;
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/modules/workspace/graphql/mutations/activateWorkspace.ts b/packages/twenty-front/src/modules/workspace/graphql/mutations/activateWorkspace.ts
new file mode 100644
index 00000000000..b116a298a62
--- /dev/null
+++ b/packages/twenty-front/src/modules/workspace/graphql/mutations/activateWorkspace.ts
@@ -0,0 +1,9 @@
+import { gql } from '@apollo/client';
+
+export const ACTIVATE_WORKSPACE = gql`
+ mutation ActivateWorkspace($input: ActivateWorkspaceInput!) {
+ activateWorkspace(data: $input) {
+ id
+ }
+ }
+`;
diff --git a/packages/twenty-front/src/pages/auth/CreateProfile.tsx b/packages/twenty-front/src/pages/auth/CreateProfile.tsx
index edb1f902214..423d9e530f9 100644
--- a/packages/twenty-front/src/pages/auth/CreateProfile.tsx
+++ b/packages/twenty-front/src/pages/auth/CreateProfile.tsx
@@ -1,6 +1,5 @@
import { useCallback } from 'react';
import { Controller, SubmitHandler, useForm } from 'react-hook-form';
-import { useNavigate } from 'react-router-dom';
import styled from '@emotion/styled';
import { zodResolver } from '@hookform/resolvers/zod';
import { useRecoilState } from 'recoil';
@@ -54,7 +53,6 @@ const validationSchema = z
type Form = z.infer<typeof validationSchema>;
export const CreateProfile = () => {
- const navigate = useNavigate();
const onboardingStatus = useOnboardingStatus();
const { enqueueSnackBar } = useSnackBar();
@@ -114,8 +112,6 @@ export const CreateProfile = () => {
colorScheme: 'System',
}) as any,
);
-
- navigate('/');
} catch (error: any) {
enqueueSnackBar(error?.message, {
variant: 'error',
@@ -125,7 +121,6 @@ export const CreateProfile = () => {
[
currentWorkspaceMember?.id,
enqueueSnackBar,
- navigate,
setCurrentWorkspaceMember,
updateOneRecord,
],
diff --git a/packages/twenty-front/src/pages/auth/CreateWorkspace.tsx b/packages/twenty-front/src/pages/auth/CreateWorkspace.tsx
index e38d21376b7..8d82f3c56f7 100644
--- a/packages/twenty-front/src/pages/auth/CreateWorkspace.tsx
+++ b/packages/twenty-front/src/pages/auth/CreateWorkspace.tsx
@@ -3,22 +3,24 @@ import { Controller, SubmitHandler, useForm } from 'react-hook-form';
import { useNavigate } from 'react-router-dom';
import styled from '@emotion/styled';
import { zodResolver } from '@hookform/resolvers/zod';
-import { useSetRecoilState } from 'recoil';
import { z } from 'zod';
import { SubTitle } from '@/auth/components/SubTitle';
import { Title } from '@/auth/components/Title';
import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
-import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
+import { FIND_MANY_OBJECT_METADATA_ITEMS } from '@/object-metadata/graphql/queries';
+import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
+import { AppPath } from '@/types/AppPath';
import { PageHotkeyScope } from '@/types/PageHotkeyScope';
import { H2Title } from '@/ui/display/typography/components/H2Title';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { MainButton } from '@/ui/input/button/components/MainButton';
import { TextInput } from '@/ui/input/components/TextInput';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
-import { useUpdateWorkspaceMutation } from '~/generated/graphql';
+import { GET_CURRENT_USER } from '@/users/graphql/queries/getCurrentUser';
+import { useActivateWorkspaceMutation } from '~/generated/graphql';
const StyledContentContainer = styled.div`
width: 100%;
@@ -46,9 +48,9 @@ export const CreateWorkspace = () => {
const { enqueueSnackBar } = useSnackBar();
const onboardingStatus = useOnboardingStatus();
- const setCurrentWorkspace = useSetRecoilState(currentWorkspaceState);
- const [updateWorkspace] = useUpdateWorkspaceMutation();
+ const [activateWorkspace] = useActivateWorkspaceMutation();
+ const apolloMetadataClient = useApolloMetadataClient();
// Form
const {
@@ -67,28 +69,25 @@ export const CreateWorkspace = () => {
const onSubmit: SubmitHandler<Form> = useCallback(
async (data) => {
try {
- const result = await updateWorkspace({
+ const result = await activateWorkspace({
variables: {
input: {
displayName: data.name,
},
},
+ refetchQueries: [GET_CURRENT_USER],
});
- setCurrentWorkspace({
- id: result.data?.updateWorkspace?.id ?? '',
- displayName: data.name,
- subscriptionStatus:
- result.data?.updateWorkspace?.subscriptionStatus ?? 'incomplete',
- allowImpersonation:
- result.data?.updateWorkspace?.allowImpersonation ?? false,
+
+ await apolloMetadataClient?.refetchQueries({
+ include: [FIND_MANY_OBJECT_METADATA_ITEMS],
});
- if (result.errors || !result.data?.updateWorkspace) {
+ if (result.errors) {
throw result.errors ?? new Error('Unknown error');
}
setTimeout(() => {
- navigate('/create/profile');
+ navigate(AppPath.CreateProfile);
}, 20);
} catch (error: any) {
enqueueSnackBar(error?.message, {
@@ -96,7 +95,7 @@ export const CreateWorkspace = () => {
});
}
},
- [enqueueSnackBar, navigate, setCurrentWorkspace, updateWorkspace],
+ [enqueueSnackBar, navigate, apolloMetadataClient, activateWorkspace],
);
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
@@ -115,7 +114,7 @@ export const CreateWorkspace = () => {
[onSubmit],
);
- if (onboardingStatus !== OnboardingStatus.OngoingWorkspaceCreation) {
+ if (onboardingStatus !== OnboardingStatus.OngoingWorkspaceActivation) {
return null;
}
diff --git a/packages/twenty-front/src/pages/auth/VerifyEffect.tsx b/packages/twenty-front/src/pages/auth/VerifyEffect.tsx
index 171e4e41518..05ced046dd8 100644
--- a/packages/twenty-front/src/pages/auth/VerifyEffect.tsx
+++ b/packages/twenty-front/src/pages/auth/VerifyEffect.tsx
@@ -6,8 +6,7 @@ import { useRecoilValue } from 'recoil';
import { useAuth } from '@/auth/hooks/useAuth';
import { useIsLogged } from '@/auth/hooks/useIsLogged';
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-
-import { AppPath } from '../../modules/types/AppPath';
+import { AppPath } from '@/types/AppPath';
export const VerifyEffect = () => {
const [searchParams] = useSearchParams();
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<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,
],
},
diff --git a/packages/twenty-front/src/pages/auth/__stories__/CreateWorkspace.stories.tsx b/packages/twenty-front/src/pages/auth/__stories__/CreateWorkspace.stories.tsx
index facfecc8b91..01de0018b4f 100644
--- a/packages/twenty-front/src/pages/auth/__stories__/CreateWorkspace.stories.tsx
+++ b/packages/twenty-front/src/pages/auth/__stories__/CreateWorkspace.stories.tsx
@@ -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,
+ ],
+ },
},
};
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<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,
],
},
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<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,
],
},
diff --git a/packages/twenty-front/src/pages/impersonate/ImpersonateEffect.tsx b/packages/twenty-front/src/pages/impersonate/ImpersonateEffect.tsx
index d54409382dd..4e0902acfa3 100644
--- a/packages/twenty-front/src/pages/impersonate/ImpersonateEffect.tsx
+++ b/packages/twenty-front/src/pages/impersonate/ImpersonateEffect.tsx
@@ -6,10 +6,9 @@ import { useRecoilState, useSetRecoilState } from 'recoil';
import { useIsLogged } from '@/auth/hooks/useIsLogged';
import { currentUserState } from '@/auth/states/currentUserState';
import { tokenPairState } from '@/auth/states/tokenPairState';
+import { AppPath } from '@/types/AppPath';
import { useImpersonateMutation } from '~/generated/graphql';
-import { AppPath } from '../../modules/types/AppPath';
-
export const ImpersonateEffect = () => {
const navigate = useNavigate();
const { userId } = useParams();
diff --git a/packages/twenty-front/src/pages/not-found/NotFound.tsx b/packages/twenty-front/src/pages/not-found/NotFound.tsx
index 613ea3cc4a6..b8de6b628e1 100644
--- a/packages/twenty-front/src/pages/not-found/NotFound.tsx
+++ b/packages/twenty-front/src/pages/not-found/NotFound.tsx
@@ -2,6 +2,7 @@ import { useNavigate } from 'react-router-dom';
import styled from '@emotion/styled';
import { SignInBackgroundMockPage } from '@/sign-in-background-mock/components/SignInBackgroundMockPage';
+import { AppPath } from '@/types/AppPath';
import { MainButton } from '@/ui/input/button/components/MainButton';
import AnimatedPlaceholder from '@/ui/layout/animated-placeholder/components/AnimatedPlaceholder';
import { StyledEmptyTextContainer } from '@/ui/layout/animated-placeholder/components/EmptyPlaceholderStyled';
@@ -49,7 +50,7 @@ export const NotFound = () => {
<MainButton
title="Back to content"
fullWidth
- onClick={() => navigate('/')}
+ onClick={() => navigate(AppPath.Index)}
/>
</StyledButtonContainer>
</StyledErrorContainer>
diff --git a/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx b/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx
index f51d3873b24..2c87d997a78 100644
--- a/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx
+++ b/packages/twenty-front/src/pages/object-record/RecordIndexPage.tsx
@@ -1,10 +1,6 @@
-import { useEffect } from 'react';
-import { useNavigate, useParams } from 'react-router-dom';
+import { useParams } from 'react-router-dom';
import styled from '@emotion/styled';
-import { isNonEmptyString } from '@sniptt/guards';
-import { useOnboardingStatus } from '@/auth/hooks/useOnboardingStatus';
-import { OnboardingStatus } from '@/auth/utils/getOnboardingStatus';
import { useObjectMetadataItemForSettings } from '@/object-metadata/hooks/useObjectMetadataItemForSettings';
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
@@ -32,10 +28,6 @@ export const RecordIndexPage = () => {
objectNamePlural,
});
- const onboardingStatus = useOnboardingStatus();
-
- const navigate = useNavigate();
-
const { findObjectMetadataItemByNamePlural } =
useObjectMetadataItemForSettings();
@@ -44,15 +36,6 @@ export const RecordIndexPage = () => {
findObjectMetadataItemByNamePlural(objectNamePlural)?.icon,
);
- useEffect(() => {
- if (
- !isNonEmptyString(objectNamePlural) &&
- onboardingStatus === OnboardingStatus.Completed
- ) {
- navigate('/');
- }
- }, [objectNamePlural, navigate, onboardingStatus]);
-
const { createOneRecord: createOneObject } = useCreateOneRecord({
objectNameSingular,
});
diff --git a/packages/twenty-front/src/testing/graphqlMocks.ts b/packages/twenty-front/src/testing/graphqlMocks.ts
index 0a6e92dfa08..9520c35cae2 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,22 +22,10 @@ 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],
- views: {
- edges: mockedViewsData.map((view) => ({
- node: view,
- cursor: null,
- })),
- pageInfo: {
- hasNextPage: false,
- hasPreviousPage: false,
- startCursor: null,
- endCursor: null,
- },
- },
},
});
}),
diff --git a/packages/twenty-front/src/testing/mock-data/metadata.ts b/packages/twenty-front/src/testing/mock-data/metadata.ts
index d5744b8e8c5..524e6aded7d 100644
--- a/packages/twenty-front/src/testing/mock-data/metadata.ts
+++ b/packages/twenty-front/src/testing/mock-data/metadata.ts
@@ -45,6 +45,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -79,6 +80,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: 'a0e7e269-d28c-49c6-8fe3-e89acef1cbf3',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -113,6 +115,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: '88ab56e5-828e-4fb2-a37c-314b8803f361',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -147,6 +150,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: '48067b53-f99f-4700-bf3a-6569d1646b21',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -169,6 +173,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -193,6 +198,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
lastName: '',
firstName: '',
@@ -218,6 +224,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -254,6 +261,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: '6510e80d-546a-4a27-9346-06590c81f068',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -276,6 +284,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -300,6 +309,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -322,6 +332,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -344,6 +355,7 @@ export const mockedPeopleMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'ccf90524-24b0-4b9a-bb01-b904c4f1328e',
@@ -380,6 +392,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -404,6 +417,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -426,6 +440,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -462,6 +477,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: 'cb2bac7e-0db7-4f10-95f2-d8d122cad29c',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -496,6 +512,7 @@ export const mockedPeopleMetadata = {
toFieldMetadataId: 'e6508bb6-0dfd-417a-b0f4-d84bc1f44883',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -518,6 +535,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -542,6 +560,7 @@ export const mockedPeopleMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -601,6 +620,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -623,6 +643,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -646,6 +667,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -681,6 +703,7 @@ export const mockedCompaniesMetadata = {
toFieldMetadataId: 'dcd5343e-98db-4cf7-aded-2c9c0da0a220',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -703,6 +726,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -727,6 +751,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -752,6 +777,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -774,6 +800,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -795,6 +822,7 @@ export const mockedCompaniesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'b6d74797-0a27-449e-8f7b-26f94de4f707',
@@ -805,6 +833,7 @@ export const mockedCompaniesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: 'f1c10310-ab4f-484b-bd03-f5f3890e964e',
},
@@ -831,6 +860,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -860,10 +890,12 @@ export const mockedCompaniesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'attachment',
namePlural: 'attachments',
+ isSystem: true,
},
toFieldMetadataId: '6e103463-aee5-4be3-af12-52cacd566c3a',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -886,6 +918,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -910,6 +943,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -935,6 +969,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -964,10 +999,12 @@ export const mockedCompaniesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'opportunity',
namePlural: 'opportunities',
+ isSystem: true,
},
toFieldMetadataId: '70b02b3a-8077-4ce1-ab8b-c5e854c31b13',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -990,6 +1027,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -1021,10 +1059,12 @@ export const mockedCompaniesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
toFieldMetadataId: 'ee0ce363-c3b4-4638-ab88-660566e3016f',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1054,10 +1094,12 @@ export const mockedCompaniesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activityTarget',
namePlural: 'activityTargets',
+ isSystem: true,
},
toFieldMetadataId: 'd9ea410b-2441-44ef-85da-03650aad5818',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1080,6 +1122,7 @@ export const mockedCompaniesMetadata = {
updatedAt: '2023-12-20T12:25:25.057Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1136,6 +1179,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -1159,6 +1203,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -1182,6 +1227,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1213,10 +1259,12 @@ export const mockedPipelineStepsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'opportunity',
namePlural: 'opportunities',
+ isSystem: true,
},
toFieldMetadataId: '4756a816-8a18-433a-9414-c756db4727e8',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1238,6 +1286,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1261,6 +1310,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -1284,6 +1334,7 @@ export const mockedPipelineStepsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 0,
},
@@ -1342,6 +1393,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1363,6 +1415,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1383,6 +1436,7 @@ export const mockedActivityTargetsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '49028648-0380-481d-b6ba-004193f83e97',
@@ -1393,6 +1447,7 @@ export const mockedActivityTargetsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'company',
namePlural: 'companies',
+ isSystem: true,
},
fromFieldMetadataId: '9a1a00ee-1595-4b00-8a33-fefb02e25c98',
},
@@ -1417,6 +1472,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1438,6 +1494,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1460,6 +1517,7 @@ export const mockedActivityTargetsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'a47ced1e-6070-4b11-b5ab-1a3d2268d8a2',
@@ -1470,6 +1528,7 @@ export const mockedActivityTargetsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activity',
namePlural: 'activities',
+ isSystem: true,
},
fromFieldMetadataId: '63bf5a31-2b3c-47ca-bb75-f1efb053ec58',
},
@@ -1493,6 +1552,7 @@ export const mockedActivityTargetsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '6100b5ae-72b3-4a02-94e9-d923c7a78d92',
@@ -1503,6 +1563,7 @@ export const mockedActivityTargetsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: '17692850-3850-4e3a-824a-03aa199847f6',
},
@@ -1527,6 +1588,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1550,6 +1612,7 @@ export const mockedActivityTargetsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -1608,6 +1671,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1631,6 +1695,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 0,
},
@@ -1654,6 +1719,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -1677,6 +1743,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -1699,6 +1766,7 @@ export const mockedFavoritesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'b3d452bc-e683-4dc6-86ec-37766ea8b30c',
@@ -1709,6 +1777,7 @@ export const mockedFavoritesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: 'dbdd6cad-20a9-4caa-8965-d1e02d7ab380',
},
@@ -1733,6 +1802,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1753,6 +1823,7 @@ export const mockedFavoritesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '4df88275-6b23-4bd4-b7a7-0893d366d8e0',
@@ -1763,6 +1834,7 @@ export const mockedFavoritesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'company',
namePlural: 'companies',
+ isSystem: true,
},
fromFieldMetadataId: '775870d6-16c1-4c94-9b58-c88bdca489e8',
},
@@ -1787,6 +1859,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1808,6 +1881,7 @@ export const mockedFavoritesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1828,6 +1902,7 @@ export const mockedFavoritesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '4e7e4ec6-2543-47c0-87cc-0c394e98271e',
@@ -1838,6 +1913,7 @@ export const mockedFavoritesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: 'da7c9f08-5de0-4807-96d4-018ff7072d15',
},
@@ -1897,6 +1973,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -1917,6 +1994,7 @@ export const mockedMessageParticipantsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'ffcedbc0-adb7-4f74-83bb-ff7e3c270183',
@@ -1927,6 +2005,7 @@ export const mockedMessageParticipantsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: 'f13cce91-5f98-4eb0-8c6e-c1cf41ad168f',
},
@@ -1951,6 +2030,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -1974,6 +2054,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -1997,6 +2078,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2017,6 +2099,7 @@ export const mockedMessageParticipantsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'fcc9ed16-2fa4-4809-8a1d-01ce0c481130',
@@ -2027,6 +2110,7 @@ export const mockedMessageParticipantsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: 'c606dfb1-a24c-4f9b-b626-0df1c845e6e8',
},
@@ -2050,6 +2134,7 @@ export const mockedMessageParticipantsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '020d2fe4-33c3-4fe1-a2cc-35a23d73d046',
@@ -2060,6 +2145,7 @@ export const mockedMessageParticipantsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'message',
namePlural: 'message',
+ isSystem: true,
},
fromFieldMetadataId: '9c58971b-4e40-4f49-b125-ff014f909744',
},
@@ -2084,6 +2170,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'from',
},
@@ -2107,6 +2194,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2130,6 +2218,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2151,6 +2240,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -2174,6 +2264,7 @@ export const mockedMessageParticipantsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2232,6 +2323,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2253,6 +2345,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -2276,6 +2369,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2307,10 +2401,12 @@ export const mockedActivitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'comment',
namePlural: 'comments',
+ isSystem: true,
},
toFieldMetadataId: '1309d13f-9945-4f8b-99e8-371fbb51b99d',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2331,6 +2427,7 @@ export const mockedActivitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '0de81eae-1ffb-4cb5-b081-ab18d5641d50',
@@ -2341,6 +2438,7 @@ export const mockedActivitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: '9a722ce5-1721-4406-a695-4a207f6f50c7',
},
@@ -2365,6 +2463,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -2396,10 +2495,12 @@ export const mockedActivitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'attachment',
namePlural: 'attachments',
+ isSystem: true,
},
toFieldMetadataId: 'd8ce8a44-872e-482e-ac9d-87f6637f5776',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2421,6 +2522,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'Note',
},
@@ -2444,6 +2546,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -2467,6 +2570,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2488,6 +2592,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2509,6 +2614,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2538,10 +2644,12 @@ export const mockedActivitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activityTarget',
namePlural: 'activityTargets',
+ isSystem: true,
},
toFieldMetadataId: '2aded974-bfa4-4ba4-b4c9-91346ac2762b',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2562,6 +2670,7 @@ export const mockedActivitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '519a92c5-8b0a-4a85-b0bc-be8d1607da5a',
@@ -2572,6 +2681,7 @@ export const mockedActivitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: '4d91396b-99ff-486f-aa23-aa90bfca4aff',
},
@@ -2596,6 +2706,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2617,6 +2728,7 @@ export const mockedActivitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2675,6 +2787,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2695,6 +2808,7 @@ export const mockedAttachmentsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '2d64b1ba-c7c2-4d96-bba3-ae2f7c2be7bc',
@@ -2705,6 +2819,7 @@ export const mockedAttachmentsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: 'dbd81b2e-f282-4846-970a-d9fbf1ab0f67',
},
@@ -2729,6 +2844,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2752,6 +2868,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+
defaultValue: {
value: '',
},
@@ -2775,6 +2892,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -2798,6 +2916,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2818,6 +2937,7 @@ export const mockedAttachmentsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '857f84a7-9934-4b3c-a7c6-3d1db427df73',
@@ -2828,6 +2948,7 @@ export const mockedAttachmentsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'company',
namePlural: 'companies',
+ isSystem: true,
},
fromFieldMetadataId: '67500175-d2d8-4b84-a6c6-4b0a0a5cca23',
},
@@ -2852,6 +2973,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -2875,6 +2997,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2896,6 +3019,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -2917,6 +3041,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -2939,6 +3064,7 @@ export const mockedAttachmentsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'a65ae523-9786-4064-8f42-346ce8055345',
@@ -2949,6 +3075,7 @@ export const mockedAttachmentsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: '0eb1a396-06a5-4b6a-8003-82e6839a2afb',
},
@@ -2973,6 +3100,7 @@ export const mockedAttachmentsMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -2995,6 +3123,7 @@ export const mockedAttachmentsMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'a45591f3-8a30-49d0-92b3-59c4110dfee7',
@@ -3005,6 +3134,7 @@ export const mockedAttachmentsMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activity',
namePlural: 'activities',
+ isSystem: true,
},
fromFieldMetadataId: '763c2a4a-e7ba-445f-9ecd-6d1d20c8b408',
},
@@ -3064,6 +3194,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'en',
},
@@ -3095,10 +3226,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageParticipant',
namePlural: 'messageParticipants',
+ isSystem: true,
},
toFieldMetadataId: '22883ca2-34e2-40ab-9e7b-fde5836cb5d2',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3120,6 +3253,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3151,10 +3285,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activity',
namePlural: 'activities',
+ isSystem: true,
},
toFieldMetadataId: '46782ee3-181c-484b-9aa9-27e57b61cc81',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3176,6 +3312,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
lastName: '',
firstName: '',
@@ -3208,10 +3345,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'favorite',
namePlural: 'favorites',
+ isSystem: true,
},
toFieldMetadataId: 'efc8bec2-de4a-4d67-9187-31394bb35119',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3233,6 +3372,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'Light',
},
@@ -3264,10 +3404,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'comment',
namePlural: 'comments',
+ isSystem: true,
},
toFieldMetadataId: 'e2c01385-7707-49e0-835c-facbf8a6e4a9',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3289,6 +3431,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3320,10 +3463,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'connectedAccount',
namePlural: 'connectedAccounts',
+ isSystem: true,
},
toFieldMetadataId: '912a9a56-4e00-4cd2-8908-b0d113c9f615',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3353,10 +3498,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'company',
namePlural: 'companies',
+ isSystem: true,
},
toFieldMetadataId: 'de0dace0-f7f8-4317-95e8-f80f6f72c7e4',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3378,6 +3525,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -3401,6 +3549,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3422,6 +3571,7 @@ export const mockedWorkspaceMembersMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3453,10 +3603,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'attachment',
namePlural: 'attachments',
+ isSystem: true,
},
toFieldMetadataId: '78bcb420-9281-4eeb-8eb6-b2f3047acc09',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3486,10 +3638,12 @@ export const mockedWorkspaceMembersMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activity',
namePlural: 'activities',
+ isSystem: true,
},
toFieldMetadataId: 'a6bd62f1-3e4c-4be0-ab64-0e7248d7d9eb',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3546,6 +3700,7 @@ export const mockedWebhooksMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3569,6 +3724,7 @@ export const mockedWebhooksMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3592,6 +3748,7 @@ export const mockedWebhooksMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -3615,6 +3772,7 @@ export const mockedWebhooksMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3638,6 +3796,7 @@ export const mockedWebhooksMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3696,6 +3855,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -3719,6 +3879,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3742,6 +3903,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3765,6 +3927,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3787,6 +3950,7 @@ export const mockedMessagesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '5ea18f96-cfb4-45af-b716-d09bfb4bb282',
@@ -3797,6 +3961,7 @@ export const mockedMessagesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageThread',
namePlural: 'messageThreads',
+ isSystem: true,
},
fromFieldMetadataId: '0d3c8828-2edb-4658-bd95-d01e4d102696',
},
@@ -3821,6 +3986,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -3852,10 +4018,12 @@ export const mockedMessagesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageParticipant',
namePlural: 'messageParticipants',
+ isSystem: true,
},
toFieldMetadataId: '663612f4-7eb8-4b21-886e-730f3b047ee7',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3877,6 +4045,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -3900,6 +4069,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'incoming',
},
@@ -3923,6 +4093,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -3944,6 +4115,7 @@ export const mockedMessagesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -4001,6 +4173,7 @@ export const mockedOpportunitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '5b6296d8-8557-4a3c-a963-109a5888b3b3',
@@ -4011,6 +4184,7 @@ export const mockedOpportunitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: '2766f41a-1f8f-413f-88a3-1e3fec0e1821',
},
@@ -4034,6 +4208,7 @@ export const mockedOpportunitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'e63587c4-c565-4f77-9b8c-a639ae366dea',
@@ -4044,6 +4219,7 @@ export const mockedOpportunitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'person',
namePlural: 'people',
+ isSystem: true,
},
fromFieldMetadataId: '586d0acc-f68b-4f08-aea9-410d88f351aa',
},
@@ -4068,6 +4244,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4089,6 +4266,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4110,6 +4288,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -4133,6 +4312,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4154,6 +4334,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4174,6 +4355,7 @@ export const mockedOpportunitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '7b0474c4-d82d-4c1d-96de-c6728b53339a',
@@ -4184,6 +4366,7 @@ export const mockedOpportunitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'pipelineStep',
namePlural: 'pipelineSteps',
+ isSystem: true,
},
fromFieldMetadataId: 'ad3e919f-4258-4e21-8caf-bf122f17ca5c',
},
@@ -4208,6 +4391,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '0',
},
@@ -4231,6 +4415,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4254,6 +4439,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4276,6 +4462,7 @@ export const mockedOpportunitiesMetadata = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'afe2078f-6c52-45ef-bb2e-f43b0ee28ecc',
@@ -4286,6 +4473,7 @@ export const mockedOpportunitiesMetadata = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'company',
namePlural: 'companies',
+ isSystem: true,
},
fromFieldMetadataId: '00b695d6-e0c6-4029-9932-817b19ae0380',
},
@@ -4310,6 +4498,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4331,6 +4520,7 @@ export const mockedOpportunitiesMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4387,6 +4577,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4408,6 +4599,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4431,6 +4623,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4452,6 +4645,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -4475,6 +4669,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4498,6 +4693,7 @@ export const mockedAPIKeysMetadata = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -4556,6 +4752,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -4578,6 +4775,7 @@ export const mockedComments = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: 'f4a1e4f4-8a26-4c7d-8973-6fdbc816fc6d',
@@ -4588,6 +4786,7 @@ export const mockedComments = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'activity',
namePlural: 'activities',
+ isSystem: true,
},
fromFieldMetadataId: 'f47a1319-bdec-4d9e-8179-17cb9df81dd6',
},
@@ -4612,6 +4811,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -4635,6 +4835,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4658,6 +4859,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4679,6 +4881,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4700,6 +4903,7 @@ export const mockedComments = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4722,6 +4926,7 @@ export const mockedComments = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '8e2a5be9-ff83-4106-bfe0-0877423559d0',
@@ -4732,6 +4937,7 @@ export const mockedComments = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: '099a5f31-0b9a-4d1a-81dc-811f0f1f0b33',
},
@@ -4759,6 +4965,7 @@ export const mockedMessageThreads = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageThread',
namePlural: 'messageThreads',
+
labelSingular: 'Message Thread',
labelPlural: 'Message Threads',
description: 'Message Thread',
@@ -4791,6 +4998,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -4814,6 +5022,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4836,6 +5045,7 @@ export const mockedMessageThreads = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '179ef8b5-41f8-4d0f-98b6-30d487431354',
@@ -4846,6 +5056,7 @@ export const mockedMessageThreads = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageChannel',
namePlural: 'messageChannels',
+ isSystem: true,
},
fromFieldMetadataId: 'db09596c-c968-41de-95ba-ae8d3c36fc00',
},
@@ -4878,10 +5089,12 @@ export const mockedMessageThreads = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'message',
namePlural: 'message',
+ isSystem: true,
},
toFieldMetadataId: '0c98eb7f-6db3-43d3-84d8-3c46a384ac5e',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -4903,6 +5116,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -4926,6 +5140,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -4949,6 +5164,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -4972,6 +5188,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'default',
},
@@ -4995,6 +5212,7 @@ export const mockedMessageThreads = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5051,6 +5269,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'metadata',
},
@@ -5082,10 +5301,12 @@ export const mockedMessageChannels = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageThread',
namePlural: 'messageThreads',
+ isSystem: true,
},
toFieldMetadataId: 'bd65743c-8d13-4e99-82cd-b1d3f365d0c4',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5107,6 +5328,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5130,6 +5352,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5153,6 +5376,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5176,6 +5400,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -5199,6 +5424,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5220,6 +5446,7 @@ export const mockedMessageChannels = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5242,6 +5469,7 @@ export const mockedMessageChannels = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '4a2d8c75-3d39-4860-9373-2bc7faf35feb',
@@ -5252,6 +5480,7 @@ export const mockedMessageChannels = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'connectedAccount',
namePlural: 'connectedAccounts',
+ isSystem: true,
},
fromFieldMetadataId: '6cb6a33d-6eb1-4bba-b1f8-a1d3f40c9158',
},
@@ -5312,6 +5541,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5335,6 +5565,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5358,6 +5589,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5389,10 +5621,12 @@ export const mockedConnectedAccounts = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'messageChannel',
namePlural: 'messageChannels',
+ isSystem: true,
},
toFieldMetadataId: '14fcf47f-b60e-4dc8-80a0-df6e16f513ac',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5414,6 +5648,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5436,6 +5671,7 @@ export const mockedConnectedAccounts = {
createdAt: '2023-12-15T15:29:39.070Z',
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
+ options: {},
toRelationMetadata: {
__typename: 'relation',
id: '7fd3bdb5-e043-495d-82b1-d75c22b70bac',
@@ -5446,6 +5682,7 @@ export const mockedConnectedAccounts = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'workspaceMember',
namePlural: 'workspaceMembers',
+ isSystem: true,
},
fromFieldMetadataId: '2c8bb89a-c60c-49bf-81ce-7074ac41caf5',
},
@@ -5470,6 +5707,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5493,6 +5731,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -5516,6 +5755,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5539,6 +5779,7 @@ export const mockedConnectedAccounts = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5597,6 +5838,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5620,6 +5862,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5652,9 +5895,11 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'view',
namePlural: 'views',
+ isSystem: true,
},
fromFieldMetadataId: '5c1342d5-199c-4746-8d3a-60d17a09d187',
},
+ options: {},
defaultValue: null,
},
},
@@ -5676,6 +5921,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'Contains',
},
@@ -5699,6 +5945,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -5722,6 +5969,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5743,6 +5991,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5766,6 +6015,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5789,6 +6039,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5844,6 +6095,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -5875,10 +6127,12 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'viewField',
namePlural: 'viewFields',
+ isSystem: true,
},
toFieldMetadataId: '7c7866c9-4bf0-4f3b-89b6-5b889858a895',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5900,6 +6154,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: '',
},
@@ -5923,6 +6178,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -5944,6 +6200,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -5975,10 +6232,12 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'viewFilter',
namePlural: 'viewFilters',
+ isSystem: true,
},
toFieldMetadataId: '5c24c599-34c5-4efe-adc6-e066be7ad20e',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6000,6 +6259,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -6031,10 +6291,12 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'viewSort',
namePlural: 'viewSorts',
+ isSystem: true,
},
toFieldMetadataId: 'bff11820-ffa2-4283-80b3-3777583f6f97',
},
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6056,6 +6318,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'table',
},
@@ -6113,6 +6376,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 0,
},
@@ -6136,6 +6400,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6157,6 +6422,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -6180,6 +6446,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 0,
},
@@ -6203,6 +6470,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: true,
},
@@ -6226,6 +6494,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: {
+ options: {},
__typename: 'relation',
id: '1ba54f4e-6e09-40a8-bc02-65b5ece7dafc',
relationType: RelationMetadataType.OneToMany,
@@ -6235,6 +6504,7 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'view',
namePlural: 'views',
+ isSystem: true,
},
fromFieldMetadataId: '58aa8432-7109-42b2-8b85-7745fef42b9e',
},
@@ -6259,6 +6529,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6280,6 +6551,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -6303,6 +6575,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -6360,6 +6633,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -6383,6 +6657,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
value: 'asc',
},
@@ -6406,6 +6681,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6427,6 +6703,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: null,
},
},
@@ -6448,6 +6725,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: 'now',
},
@@ -6471,6 +6749,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: null,
+ options: {},
defaultValue: {
type: FieldMetadataType.Uuid,
},
@@ -6494,6 +6773,7 @@ export const mockedObjectMetadataItems = {
updatedAt: '2023-12-15T15:29:39.070Z',
fromRelationMetadata: null,
toRelationMetadata: {
+ options: {},
__typename: 'relation',
id: '22a37761-f528-4a9b-8194-1fed1df69019',
relationType: RelationMetadataType.OneToMany,
@@ -6503,6 +6783,7 @@ export const mockedObjectMetadataItems = {
dataSourceId: 'cabbcaa6-05d6-41f4-920f-9144172a4f08',
nameSingular: 'view',
namePlural: 'views',
+ isSystem: true,
},
fromFieldMetadataId: 'bdbecafb-972e-43f4-9296-c5a59bad449d',
},
diff --git a/packages/twenty-front/src/testing/mock-data/users.ts b/packages/twenty-front/src/testing/mock-data/users.ts
index 712dd693c2f..f7b27713e98 100644
--- a/packages/twenty-front/src/testing/mock-data/users.ts
+++ b/packages/twenty-front/src/testing/mock-data/users.ts
@@ -11,7 +11,7 @@ type MockedUser = Pick<
| '__typename'
| 'supportUserHash'
> & {
- workspaceMember: WorkspaceMember;
+ workspaceMember: WorkspaceMember | null;
locale: string;
defaultWorkspace: Workspace;
};
@@ -34,7 +34,7 @@ export const mockDefaultWorkspace: Workspace = {
updatedAt: '2023-04-26T10:23:42.33625+00:00',
};
-const workspaceMember: WorkspaceMember = {
+export const mockedWorkspaceMemberData: WorkspaceMember = {
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
colorScheme: 'Light',
avatarUrl,
@@ -59,7 +59,7 @@ export const mockedUsersData: Array<MockedUser> = [
canImpersonate: false,
supportUserHash:
'a95afad9ff6f0b364e2a3fd3e246a1a852c22b6e55a3ca33745a86c201f9c10d',
- workspaceMember,
+ workspaceMember: mockedWorkspaceMemberData,
defaultWorkspace: mockDefaultWorkspace,
locale: 'en',
},
@@ -73,7 +73,7 @@ export const mockedUsersData: Array<MockedUser> = [
supportUserHash:
'54ac3986035961724cdb9a7a30c70e6463a4b68f0ecd2014c727171a82144b74',
workspaceMember: {
- ...workspaceMember,
+ ...mockedWorkspaceMemberData,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
name: {
firstName: 'Felix',
@@ -97,7 +97,7 @@ export const mockedOnboardingUsersData: Array<MockedUser> = [
supportUserHash:
'4fb61d34ed3a4aeda2476d4b308b5162db9e1809b2b8277e6fdc6efc4a609254',
workspaceMember: {
- ...workspaceMember,
+ ...mockedWorkspaceMemberData,
id: 'd454f075-c72f-4ebe-bac7-d28e75e74a23',
name: {
firstName: '',
@@ -116,7 +116,7 @@ export const mockedOnboardingUsersData: Array<MockedUser> = [
firstName: '',
lastName: '',
canImpersonate: false,
- workspaceMember,
+ workspaceMember: null,
defaultWorkspace: {
...mockDefaultWorkspace,
displayName: '',
diff --git a/packages/twenty-server/src/core/auth/auth.resolver.ts b/packages/twenty-server/src/core/auth/auth.resolver.ts
index 0283260bc52..91fd56667ae 100644
--- a/packages/twenty-server/src/core/auth/auth.resolver.ts
+++ b/packages/twenty-server/src/core/auth/auth.resolver.ts
@@ -101,6 +101,10 @@ export class AuthResolver {
@AuthUser() user: User,
): Promise<TransientToken | void> {
const workspaceMember = await this.userService.loadWorkspaceMember(user);
+
+ if (!workspaceMember) {
+ return;
+ }
const transientToken = await this.tokenService.generateTransientToken(
workspaceMember.id,
user.defaultWorkspace.id,
diff --git a/packages/twenty-server/src/core/auth/services/auth.service.ts b/packages/twenty-server/src/core/auth/services/auth.service.ts
index 660cd44e0b7..946bb698569 100644
--- a/packages/twenty-server/src/core/auth/services/auth.service.ts
+++ b/packages/twenty-server/src/core/auth/services/auth.service.ts
@@ -7,11 +7,11 @@ import {
import { InjectRepository } from '@nestjs/typeorm';
import { HttpService } from '@nestjs/axios';
-import FileType from 'file-type';
import { Repository } from 'typeorm';
import { v4 } from 'uuid';
import { render } from '@react-email/components';
import { PasswordUpdateNotifyEmail } from 'twenty-emails';
+import FileType from 'file-type';
import { FileFolder } from 'src/core/file/interfaces/file-folder.interface';
@@ -29,11 +29,11 @@ import { User } from 'src/core/user/user.entity';
import { Workspace } from 'src/core/workspace/workspace.entity';
import { UserService } from 'src/core/user/services/user.service';
import { WorkspaceManagerService } from 'src/workspace/workspace-manager/workspace-manager.service';
-import { getImageBufferFromUrl } from 'src/utils/image';
import { FileUploadService } from 'src/core/file/services/file-upload.service';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
import { EmailService } from 'src/integrations/email/email.service';
import { UpdatePassword } from 'src/core/auth/dto/update-password.entity';
+import { getImageBufferFromUrl } from 'src/utils/image';
import { TokenService } from './token.service';
@@ -135,18 +135,8 @@ export class AuthService {
});
workspace = await this.workspaceRepository.save(workspaceToCreate);
- await this.workspaceManagerService.init(workspace.id);
}
- const userToCreate = this.userRepository.create({
- email: email,
- firstName: firstName,
- lastName: lastName,
- canImpersonate: false,
- passwordHash,
- defaultWorkspace: workspace,
- });
- const user = await this.userRepository.save(userToCreate);
let imagePath: string | undefined = undefined;
if (picture) {
@@ -166,9 +156,18 @@ export class AuthService {
imagePath = paths[0];
}
- await this.userService.createWorkspaceMember(user, imagePath);
- return user;
+ const userToCreate = this.userRepository.create({
+ email: email,
+ firstName: firstName,
+ lastName: lastName,
+ defaultAvatarUrl: imagePath,
+ canImpersonate: false,
+ passwordHash,
+ defaultWorkspace: workspace,
+ });
+
+ return await this.userRepository.save(userToCreate);
}
async verify(email: string): Promise<Verify> {
@@ -189,7 +188,11 @@ export class AuthService {
// passwordHash is hidden for security reasons
user.passwordHash = '';
- user.workspaceMember = await this.userService.loadWorkspaceMember(user);
+ const workspaceMember = await this.userService.loadWorkspaceMember(user);
+
+ if (workspaceMember) {
+ user.workspaceMember = workspaceMember;
+ }
const accessToken = await this.tokenService.generateAccessToken(user.id);
const refreshToken = await this.tokenService.generateRefreshToken(user.id);
diff --git a/packages/twenty-server/src/core/user/services/user.service.ts b/packages/twenty-server/src/core/user/services/user.service.ts
index ad23e938d70..c3a322c9ed1 100644
--- a/packages/twenty-server/src/core/user/services/user.service.ts
+++ b/packages/twenty-server/src/core/user/services/user.service.ts
@@ -21,11 +21,23 @@ export class UserService extends TypeOrmQueryService<User> {
}
async loadWorkspaceMember(user: User) {
- const dataSourceMetadata =
- await this.dataSourceService.getLastDataSourceMetadataFromWorkspaceIdOrFail(
+ const dataSourcesMetadata =
+ await this.dataSourceService.getDataSourcesMetadataFromWorkspaceId(
user.defaultWorkspace.id,
);
+ if (!dataSourcesMetadata.length) {
+ return;
+ }
+
+ if (dataSourcesMetadata.length > 1) {
+ throw new Error(
+ `user '${user.id}' default workspace '${user.defaultWorkspace.id}' has multiple data source metadata`,
+ );
+ }
+
+ const dataSourceMetadata = dataSourcesMetadata[0];
+
const workspaceDataSource =
await this.typeORMService.connectToDataSource(dataSourceMetadata);
@@ -33,6 +45,10 @@ export class UserService extends TypeOrmQueryService<User> {
`SELECT * FROM ${dataSourceMetadata.schema}."workspaceMember" WHERE "userId" = '${user.id}'`,
);
+ if (!workspaceMembers.length) {
+ return;
+ }
+
assert(workspaceMembers.length === 1, 'WorkspaceMember not found');
const userWorkspaceMember = new WorkspaceMember();
@@ -63,7 +79,7 @@ export class UserService extends TypeOrmQueryService<User> {
);
}
- async createWorkspaceMember(user: User, avatarUrl?: string) {
+ async createWorkspaceMember(user: User) {
const dataSourceMetadata =
await this.dataSourceService.getLastDataSourceMetadataFromWorkspaceIdOrFail(
user.defaultWorkspace.id,
@@ -77,7 +93,7 @@ export class UserService extends TypeOrmQueryService<User> {
("nameFirstName", "nameLastName", "colorScheme", "userId", "userEmail", "avatarUrl")
VALUES ('${user.firstName}', '${user.lastName}', 'Light', '${
user.id
- }', '${user.email}', '${avatarUrl ?? ''}')`,
+ }', '${user.email}', '${user.defaultAvatarUrl ?? ''}')`,
);
}
diff --git a/packages/twenty-server/src/core/user/user.entity.ts b/packages/twenty-server/src/core/user/user.entity.ts
index bc6980bcd5e..903938c133e 100644
--- a/packages/twenty-server/src/core/user/user.entity.ts
+++ b/packages/twenty-server/src/core/user/user.entity.ts
@@ -34,6 +34,10 @@ export class User {
@Column()
email: string;
+ @Field({ nullable: true })
+ @Column({ nullable: true })
+ defaultAvatarUrl: string;
+
@Field()
@Column({ default: false })
emailVerified: boolean;
@@ -81,6 +85,6 @@ export class User {
})
refreshTokens: RefreshToken[];
- @Field(() => WorkspaceMember, { nullable: false })
+ @Field(() => WorkspaceMember, { nullable: true })
workspaceMember: WorkspaceMember;
}
diff --git a/packages/twenty-server/src/core/user/user.resolver.ts b/packages/twenty-server/src/core/user/user.resolver.ts
index a6e6c6cdfbf..d936d68d671 100644
--- a/packages/twenty-server/src/core/user/user.resolver.ts
+++ b/packages/twenty-server/src/core/user/user.resolver.ts
@@ -55,9 +55,11 @@ export class UserResolver {
}
@ResolveField(() => WorkspaceMember, {
- nullable: false,
+ nullable: true,
})
- async workspaceMember(@Parent() user: User): Promise<WorkspaceMember> {
+ async workspaceMember(
+ @Parent() user: User,
+ ): Promise<WorkspaceMember | undefined> {
return this.userService.loadWorkspaceMember(user);
}
diff --git a/packages/twenty-server/src/core/workspace/dtos/activate-workspace-input.ts b/packages/twenty-server/src/core/workspace/dtos/activate-workspace-input.ts
new file mode 100644
index 00000000000..563203c9f27
--- /dev/null
+++ b/packages/twenty-server/src/core/workspace/dtos/activate-workspace-input.ts
@@ -0,0 +1,11 @@
+import { Field, InputType } from '@nestjs/graphql';
+
+import { IsOptional, IsString } from 'class-validator';
+
+@InputType()
+export class ActivateWorkspaceInput {
+ @Field({ nullable: true })
+ @IsString()
+ @IsOptional()
+ displayName?: string;
+}
diff --git a/packages/twenty-server/src/core/workspace/services/workspace.service.spec.ts b/packages/twenty-server/src/core/workspace/services/workspace.service.spec.ts
index 3920b20ba36..46350109df6 100644
--- a/packages/twenty-server/src/core/workspace/services/workspace.service.spec.ts
+++ b/packages/twenty-server/src/core/workspace/services/workspace.service.spec.ts
@@ -3,6 +3,7 @@ import { getRepositoryToken } from '@nestjs/typeorm';
import { Workspace } from 'src/core/workspace/workspace.entity';
import { WorkspaceManagerService } from 'src/workspace/workspace-manager/workspace-manager.service';
+import { UserService } from 'src/core/user/services/user.service';
import { WorkspaceService } from './workspace.service';
@@ -21,6 +22,10 @@ describe('WorkspaceService', () => {
provide: WorkspaceManagerService,
useValue: {},
},
+ {
+ provide: UserService,
+ useValue: {},
+ },
],
}).compile();
diff --git a/packages/twenty-server/src/core/workspace/services/workspace.service.ts b/packages/twenty-server/src/core/workspace/services/workspace.service.ts
index c961c7ea6a4..0c4a8f6eb3f 100644
--- a/packages/twenty-server/src/core/workspace/services/workspace.service.ts
+++ b/packages/twenty-server/src/core/workspace/services/workspace.service.ts
@@ -1,4 +1,5 @@
import { InjectRepository } from '@nestjs/typeorm';
+import { BadRequestException } from '@nestjs/common';
import assert from 'assert';
@@ -7,16 +8,33 @@ import { Repository } from 'typeorm';
import { WorkspaceManagerService } from 'src/workspace/workspace-manager/workspace-manager.service';
import { Workspace } from 'src/core/workspace/workspace.entity';
+import { User } from 'src/core/user/user.entity';
+import { UserService } from 'src/core/user/services/user.service';
+import { ActivateWorkspaceInput } from 'src/core/workspace/dtos/activate-workspace-input';
export class WorkspaceService extends TypeOrmQueryService<Workspace> {
constructor(
@InjectRepository(Workspace, 'core')
private readonly workspaceRepository: Repository<Workspace>,
private readonly workspaceManagerService: WorkspaceManagerService,
+ private readonly userService: UserService,
) {
super(workspaceRepository);
}
+ async activateWorkspace(user: User, data: ActivateWorkspaceInput) {
+ if (!data.displayName || !data.displayName.length) {
+ throw new BadRequestException("'displayName' not provided");
+ }
+ await this.workspaceRepository.update(user.defaultWorkspace.id, {
+ displayName: data.displayName,
+ });
+ await this.workspaceManagerService.init(user.defaultWorkspace.id);
+ await this.userService.createWorkspaceMember(user);
+
+ return user.defaultWorkspace;
+ }
+
async deleteWorkspace(id: string, shouldDeleteCoreWorkspace = true) {
const workspace = await this.workspaceRepository.findOneBy({ id });
diff --git a/packages/twenty-server/src/core/workspace/workspace.module.ts b/packages/twenty-server/src/core/workspace/workspace.module.ts
index 052b819507a..049f773c7b6 100644
--- a/packages/twenty-server/src/core/workspace/workspace.module.ts
+++ b/packages/twenty-server/src/core/workspace/workspace.module.ts
@@ -8,6 +8,7 @@ import { WorkspaceManagerModule } from 'src/workspace/workspace-manager/workspac
import { WorkspaceResolver } from 'src/core/workspace/workspace.resolver';
import { TypeORMModule } from 'src/database/typeorm/typeorm.module';
import { FeatureFlagEntity } from 'src/core/feature-flag/feature-flag.entity';
+import { UserModule } from 'src/core/user/user.module';
import { Workspace } from './workspace.entity';
import { workspaceAutoResolverOpts } from './workspace.auto-resolver-opts';
@@ -24,6 +25,7 @@ import { WorkspaceService } from './services/workspace.service';
'core',
),
WorkspaceManagerModule,
+ UserModule,
FileModule,
],
services: [WorkspaceService],
diff --git a/packages/twenty-server/src/core/workspace/workspace.resolver.ts b/packages/twenty-server/src/core/workspace/workspace.resolver.ts
index a093feaee40..4bff0225992 100644
--- a/packages/twenty-server/src/core/workspace/workspace.resolver.ts
+++ b/packages/twenty-server/src/core/workspace/workspace.resolver.ts
@@ -12,6 +12,9 @@ import { assert } from 'src/utils/assert';
import { JwtAuthGuard } from 'src/guards/jwt.auth.guard';
import { UpdateWorkspaceInput } from 'src/core/workspace/dtos/update-workspace-input';
import { EnvironmentService } from 'src/integrations/environment/environment.service';
+import { User } from 'src/core/user/user.entity';
+import { AuthUser } from 'src/decorators/auth/auth-user.decorator';
+import { ActivateWorkspaceInput } from 'src/core/workspace/dtos/activate-workspace-input';
import { Workspace } from './workspace.entity';
@@ -35,6 +38,15 @@ export class WorkspaceResolver {
return workspace;
}
+ @Mutation(() => Workspace)
+ @UseGuards(JwtAuthGuard)
+ async activateWorkspace(
+ @Args('data') data: ActivateWorkspaceInput,
+ @AuthUser() user: User,
+ ) {
+ return await this.workspaceService.activateWorkspace(user, data);
+ }
+
@Mutation(() => Workspace)
async updateWorkspace(
@Args('data') data: UpdateWorkspaceInput,