Twenty standard and workspace custom applications 1/3 (#15625)
# Introduction related to https://github.com/twentyhq/core-team-issues/issues/1833 In this PR we're starting the sync-metadata and standardIds deprecation by introducing `twenty-standard` application that will regroup every standard object such as company and opportunities. But also the `custom-workspace-application` which is an app created at the same time as a workspace and that will regroup everything configure within the workspace ( custom objects fields etc ) ## What's done On both new workspace and seeded workspace creation: - Creating a custom workspace app - Creating a twenty standard app - Refactored the seed core schema and workspace creation to be run within a transaction in order to handle circular dependency foreignkey requirements ( which is deferred for app toward workspace ) - Updated workspace entity to have a custom workspace relation ( nullable for the moment until we implem an upgrade command to handle retro comp ) - Integration testing on user, workspace creation deletion and expected default apps creation - ~~Soft deleted user on `deleteUser`~~ Done by marie and rebased on it ## What's next - Update seeder to propagate the `twenty-standard` workspace `applicationId` to every standard synchronized entities ( cheap and fast iteration through the about to be deprecated sync-metadata as an easy way to synchronize standards metadata entities ). - Update seeder to propagate the `custom-workspace-application` workspace `applicationId` to anything custom ( `pets` and `rockets` ) - Prepend `custom-workspace-application` `applicationId` to every metadata API operations ( create a specific cache etc ) - Upgrade command on all existing workspace to create a custom app and associate its applicationId to any existing custom entities - Make `universalIdentifier` and `applicationId` required for any syncable entity
This commit is contained in:
@@ -222,6 +222,7 @@ export type Application = {
|
||||
name: Scalars['String'];
|
||||
objects: Array<Object>;
|
||||
serverlessFunctions: Array<ServerlessFunction>;
|
||||
universalIdentifier: Scalars['String'];
|
||||
version: Scalars['String'];
|
||||
};
|
||||
|
||||
@@ -4802,6 +4803,7 @@ export type Workspace = {
|
||||
viewGroups?: Maybe<Array<CoreViewGroup>>;
|
||||
viewSorts?: Maybe<Array<CoreViewSort>>;
|
||||
views?: Maybe<Array<CoreView>>;
|
||||
workspaceCustomApplicationId?: Maybe<Scalars['String']>;
|
||||
workspaceMembersCount?: Maybe<Scalars['Float']>;
|
||||
workspaceUrls: WorkspaceUrls;
|
||||
};
|
||||
|
||||
@@ -222,6 +222,7 @@ export type Application = {
|
||||
name: Scalars['String'];
|
||||
objects: Array<Object>;
|
||||
serverlessFunctions: Array<ServerlessFunction>;
|
||||
universalIdentifier: Scalars['String'];
|
||||
version: Scalars['String'];
|
||||
};
|
||||
|
||||
@@ -4630,6 +4631,7 @@ export type Workspace = {
|
||||
viewGroups?: Maybe<Array<CoreViewGroup>>;
|
||||
viewSorts?: Maybe<Array<CoreViewSort>>;
|
||||
views?: Maybe<Array<CoreView>>;
|
||||
workspaceCustomApplicationId?: Maybe<Scalars['String']>;
|
||||
workspaceMembersCount?: Maybe<Scalars['Float']>;
|
||||
workspaceUrls: WorkspaceUrls;
|
||||
};
|
||||
|
||||
+4
-2
@@ -1,14 +1,16 @@
|
||||
import { SettingsAdminTableCard } from '@/settings/admin-panel/components/SettingsAdminTableCard';
|
||||
import { SettingsAdminVersionDisplay } from '@/settings/admin-panel/components/SettingsAdminVersionDisplay';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { IconCircleDot, IconStatusChange } from 'twenty-ui/display';
|
||||
import type { Application } from '~/generated/graphql';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
export const SettingsApplicationVersionContainer = ({
|
||||
application,
|
||||
}: {
|
||||
application?: Omit<Application, 'objects'> & { objects: { id: string }[] };
|
||||
application?: Omit<Application, 'objects' | 'universalIdentifier'> & {
|
||||
objects: { id: string }[];
|
||||
};
|
||||
}) => {
|
||||
const loading = !isDefined(application);
|
||||
|
||||
|
||||
+6
-4
@@ -1,15 +1,17 @@
|
||||
import type { Application } from '~/generated/graphql';
|
||||
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { H2Title } from 'twenty-ui/display';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
|
||||
import type { Application } from '~/generated/graphql';
|
||||
import { SettingsApplicationVersionContainer } from '~/pages/settings/applications/components/SettingsApplicationVersionContainer';
|
||||
|
||||
export const SettingsApplicationDetailAboutTab = ({
|
||||
application,
|
||||
}: {
|
||||
application?: Omit<Application, 'objects'> & { objects: { id: string }[] };
|
||||
application?: Omit<Application, 'objects' | 'universalIdentifier'> & {
|
||||
objects: { id: string }[];
|
||||
};
|
||||
}) => {
|
||||
if (!isDefined(application)) {
|
||||
return null;
|
||||
|
||||
+3
-1
@@ -12,7 +12,9 @@ import { SettingsObjectTable } from '~/pages/settings/data-model/SettingsObjectT
|
||||
export const SettingsApplicationDetailContentTab = ({
|
||||
application,
|
||||
}: {
|
||||
application?: Omit<Application, 'objects'> & { objects: { id: string }[] };
|
||||
application?: Omit<Application, 'objects' | 'universalIdentifier'> & {
|
||||
objects: { id: string }[];
|
||||
};
|
||||
}) => {
|
||||
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
|
||||
|
||||
|
||||
+5
-3
@@ -1,12 +1,14 @@
|
||||
import type { Application } from '~/generated/graphql';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { SettingsApplicationDetailEnvironmentVariablesTable } from '~/pages/settings/applications/tabs/SettingsApplicationDetailEnvironmentVariablesTable';
|
||||
import type { Application } from '~/generated/graphql';
|
||||
import { useUpdateOneApplicationVariable } from '~/pages/settings/applications/hooks/useUpdateOneApplicationVariable';
|
||||
import { SettingsApplicationDetailEnvironmentVariablesTable } from '~/pages/settings/applications/tabs/SettingsApplicationDetailEnvironmentVariablesTable';
|
||||
|
||||
export const SettingsApplicationDetailSettingsTab = ({
|
||||
application,
|
||||
}: {
|
||||
application?: Omit<Application, 'objects'> & { objects: { id: string }[] };
|
||||
application?: Omit<Application, 'objects' | 'universalIdentifier'> & {
|
||||
objects: { id: string }[];
|
||||
};
|
||||
}) => {
|
||||
const { updateOneApplicationVariable } = useUpdateOneApplicationVariable();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user