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:
Paul Rastoin
2025-11-10 16:13:12 +01:00
committed by GitHub
parent 9a80164cf3
commit 7a1e699fc8
106 changed files with 2167 additions and 985 deletions
@@ -29,6 +29,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.attachment,
namePlural: 'attachments',
labelSingular: msg`Attachment`,
labelPlural: msg`Attachments`,
@@ -17,6 +17,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.blocklist,
namePlural: 'blocklists',
labelSingular: msg`Blocklist`,
labelPlural: msg`Blocklists`,
@@ -19,6 +19,7 @@ import { CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standa
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.calendarChannelEventAssociation,
namePlural: 'calendarChannelEventAssociations',
labelSingular: msg`Calendar Channel Event Association`,
labelPlural: msg`Calendar Channel Event Associations`,
@@ -69,6 +69,7 @@ registerEnumType(CalendarChannelContactAutoCreationPolicy, {
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.calendarChannel,
namePlural: 'calendarChannels',
labelSingular: msg`Calendar Channel`,
labelPlural: msg`Calendar Channels`,
@@ -28,6 +28,7 @@ export enum CalendarEventParticipantResponseStatus {
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.calendarEventParticipant,
namePlural: 'calendarEventParticipants',
labelSingular: msg`Calendar event participant`,
labelPlural: msg`Calendar event participants`,
@@ -21,6 +21,7 @@ import { CalendarEventParticipantWorkspaceEntity } from 'src/modules/calendar/co
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.calendarEvent,
namePlural: 'calendarEvents',
labelSingular: msg`Calendar event`,
labelPlural: msg`Calendar events`,
@@ -49,6 +49,7 @@ export const SEARCH_FIELDS_FOR_COMPANY: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.company,
namePlural: 'companies',
labelSingular: msg`Company`,
labelPlural: msg`Companies`,
@@ -25,6 +25,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.connectedAccount,
namePlural: 'connectedAccounts',
labelSingular: msg`Connected Account`,
labelPlural: msg`Connected Accounts`,
@@ -35,6 +35,7 @@ export const SEARCH_FIELDS_FOR_DASHBOARD: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.dashboard,
namePlural: 'dashboards',
labelSingular: msg`Dashboard`,
labelPlural: msg`Dashboards`,
@@ -15,6 +15,7 @@ import { FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/f
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.favoriteFolder,
namePlural: 'favoriteFolders',
labelSingular: msg`Favorite Folder`,
labelPlural: msg`Favorite Folders`,
@@ -30,6 +30,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.favorite,
namePlural: 'favorites',
labelSingular: msg`Favorite`,
labelPlural: msg`Favorites`,
@@ -25,6 +25,7 @@ import { MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-ob
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.messageChannelMessageAssociation,
namePlural: 'messageChannelMessageAssociations',
labelSingular: msg`Message Channel Message Association`,
labelPlural: msg`Message Channel Message Associations`,
@@ -98,6 +98,7 @@ registerEnumType(MessageChannelPendingGroupEmailsAction, {
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.messageChannel,
namePlural: 'messageChannels',
labelSingular: msg`Message Channel`,
labelPlural: msg`Message Channels`,
@@ -31,6 +31,7 @@ registerEnumType(MessageFolderPendingSyncAction, {
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.messageFolder,
namePlural: 'messageFolders',
labelSingular: msg`Message Folder`,
labelPlural: msg`Message Folders`,
@@ -21,6 +21,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.messageParticipant,
namePlural: 'messageParticipants',
labelSingular: msg`Message Participant`,
labelPlural: msg`Message Participants`,
@@ -17,6 +17,7 @@ import { MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-ob
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.messageThread,
namePlural: 'messageThreads',
labelSingular: msg`Message Thread`,
labelPlural: msg`Message Threads`,
@@ -21,6 +21,7 @@ import { MessageThreadWorkspaceEntity } from 'src/modules/messaging/common/stand
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.message,
namePlural: 'messages',
labelSingular: msg`Message`,
labelPlural: msg`Messages`,
@@ -22,6 +22,7 @@ import { PersonWorkspaceEntity } from 'src/modules/person/standard-objects/perso
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.noteTarget,
namePlural: 'noteTargets',
labelSingular: msg`Note Target`,
labelPlural: msg`Note Targets`,
@@ -39,6 +39,7 @@ export const SEARCH_FIELDS_FOR_NOTES: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.note,
namePlural: 'notes',
labelSingular: msg`Note`,
labelPlural: msg`Notes`,
@@ -42,6 +42,7 @@ export const SEARCH_FIELDS_FOR_OPPORTUNITY: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.opportunity,
namePlural: 'opportunities',
labelSingular: msg`Opportunity`,
labelPlural: msg`Opportunities`,
@@ -55,6 +55,7 @@ export const SEARCH_FIELDS_FOR_PERSON: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.person,
namePlural: 'people',
labelSingular: msg`Person`,
labelPlural: msg`People`,
@@ -22,6 +22,7 @@ import { TaskWorkspaceEntity } from 'src/modules/task/standard-objects/task.work
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.taskTarget,
namePlural: 'taskTargets',
labelSingular: msg`Task Target`,
labelPlural: msg`Task Targets`,
@@ -42,6 +42,7 @@ export const SEARCH_FIELDS_FOR_TASKS: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.task,
namePlural: 'tasks',
labelSingular: msg`Task`,
labelPlural: msg`Tasks`,
@@ -30,6 +30,7 @@ import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/sta
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.timelineActivity,
namePlural: 'timelineActivities',
labelSingular: msg`Timeline Activity`,
labelPlural: msg`Timeline Activities`,
@@ -24,6 +24,7 @@ export enum AutomatedTriggerType {
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workflowAutomatedTrigger,
namePlural: 'workflowAutomatedTriggers',
labelSingular: msg`WorkflowAutomatedTrigger`,
labelPlural: msg`WorkflowAutomatedTriggers`,
@@ -81,6 +81,7 @@ export const SEARCH_FIELDS_FOR_WORKFLOW_RUNS: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workflowRun,
namePlural: 'workflowRuns',
labelSingular: msg`Workflow Run`,
labelPlural: msg`Workflow Runs`,
@@ -72,6 +72,7 @@ export const SEARCH_FIELDS_FOR_WORKFLOW_VERSIONS: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workflowVersion,
namePlural: 'workflowVersions',
labelSingular: msg`Workflow Version`,
labelPlural: msg`Workflow Versions`,
@@ -65,6 +65,7 @@ export const SEARCH_FIELDS_FOR_WORKFLOWS: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workflow,
namePlural: 'workflows',
labelSingular: msg`Workflow`,
labelPlural: msg`Workflows`,
@@ -87,6 +87,7 @@ export const SEARCH_FIELDS_FOR_WORKSPACE_MEMBER: FieldTypeAndNameMetadata[] = [
@WorkspaceEntity({
standardId: STANDARD_OBJECT_IDS.workspaceMember,
namePlural: 'workspaceMembers',
labelSingular: msg`Workspace Member`,
labelPlural: msg`Workspace Members`,