Remove sync-metadata and IS_WORKSPACE_CREATION_V2_ENABLED feature flag (#16997)
# Introduction Followup of https://github.com/twentyhq/twenty/pull/17001#pullrequestreview-3638508738 close https://github.com/twentyhq/core-team-issues/issues/1910 We've completely decom the `sync-metadata` in production. We're now then removing its implementation in favor of the v2. ## TODO: - [x] Remove sync-metadata implem and commands - [x] Remove workspace decorators - [x] Type each deprecated field to deprecated on their workspaceEntity - [x] Remove the `workspace-sync-metadata` folder entirely - [x] remove workspace migration - [x] workspace migration removal migration - [x] remove the `v2` references from workspace manager file names - [x] remove the `v2` references from workspace manager modules - [ ] Double check impact on translation file path updates ## Note - Removed the gate logic - Remains some service v2 naming, serverless needs to be migrated on v2 fully - Removed workspaceMigration service app health consumption, making it always returning up ( no more down ) cc @FelixMalfait ( quite obsolete health check now, will require complete refactor once we introduce inter app dependency etc )
This commit is contained in:
+11
-111
@@ -1,119 +1,19 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import { RelationOnDeleteAction } from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { NOTE_TARGET_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity';
|
||||
import { NoteWorkspaceEntity } from 'src/modules/note/standard-objects/note.workspace-entity';
|
||||
import { OpportunityWorkspaceEntity } from 'src/modules/opportunity/standard-objects/opportunity.workspace-entity';
|
||||
import { PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity';
|
||||
import { type CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type CompanyWorkspaceEntity } from 'src/modules/company/standard-objects/company.workspace-entity';
|
||||
import { type NoteWorkspaceEntity } from 'src/modules/note/standard-objects/note.workspace-entity';
|
||||
import { type OpportunityWorkspaceEntity } from 'src/modules/opportunity/standard-objects/opportunity.workspace-entity';
|
||||
import { type PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.noteTarget,
|
||||
|
||||
namePlural: 'noteTargets',
|
||||
labelSingular: msg`Note Target`,
|
||||
labelPlural: msg`Note Targets`,
|
||||
description: msg`A note target`,
|
||||
icon: STANDARD_OBJECT_ICONS.noteTarget,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
export class NoteTargetWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_TARGET_STANDARD_FIELD_IDS.note,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Note`,
|
||||
description: msg`NoteTarget note`,
|
||||
icon: 'IconNotes',
|
||||
inverseSideTarget: () => NoteWorkspaceEntity,
|
||||
inverseSideFieldKey: 'noteTargets',
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
note: Relation<NoteWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('note')
|
||||
note: EntityRelation<NoteWorkspaceEntity> | null;
|
||||
noteId: string | null;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_TARGET_STANDARD_FIELD_IDS.person,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Person`,
|
||||
description: msg`NoteTarget person`,
|
||||
icon: 'IconUser',
|
||||
inverseSideTarget: () => PersonWorkspaceEntity,
|
||||
inverseSideFieldKey: 'noteTargets',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
person: Relation<PersonWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('person')
|
||||
person: EntityRelation<PersonWorkspaceEntity> | null;
|
||||
personId: string | null;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_TARGET_STANDARD_FIELD_IDS.company,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Company`,
|
||||
description: msg`NoteTarget company`,
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
inverseSideTarget: () => CompanyWorkspaceEntity,
|
||||
inverseSideFieldKey: 'noteTargets',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
company: Relation<CompanyWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('company')
|
||||
company: EntityRelation<CompanyWorkspaceEntity> | null;
|
||||
companyId: string | null;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_TARGET_STANDARD_FIELD_IDS.opportunity,
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
label: msg`Opportunity`,
|
||||
description: msg`NoteTarget opportunity`,
|
||||
icon: 'IconTargetArrow',
|
||||
inverseSideTarget: () => OpportunityWorkspaceEntity,
|
||||
inverseSideFieldKey: 'noteTargets',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
@WorkspaceIsNullable()
|
||||
opportunity: Relation<OpportunityWorkspaceEntity> | null;
|
||||
|
||||
@WorkspaceJoinColumn('opportunity')
|
||||
opportunity: EntityRelation<OpportunityWorkspaceEntity> | null;
|
||||
opportunityId: string | null;
|
||||
|
||||
// todo: remove this decorator and the custom field
|
||||
@WorkspaceDynamicRelation({
|
||||
type: RelationType.MANY_TO_ONE,
|
||||
argsFactory: (oppositeObjectMetadata) => ({
|
||||
standardId: NOTE_TARGET_STANDARD_FIELD_IDS.custom,
|
||||
name: oppositeObjectMetadata.nameSingular,
|
||||
label: oppositeObjectMetadata.labelSingular,
|
||||
description: `NoteTarget ${oppositeObjectMetadata.labelSingular}`,
|
||||
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
}),
|
||||
inverseSideTarget: () => CustomWorkspaceEntity,
|
||||
inverseSideFieldKey: 'noteTargets',
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
custom: Relation<CustomWorkspaceEntity>;
|
||||
custom: EntityRelation<CustomWorkspaceEntity>;
|
||||
}
|
||||
|
||||
+11
-151
@@ -1,36 +1,16 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { STANDARD_OBJECT_IDS } from 'twenty-shared/metadata';
|
||||
import {
|
||||
ActorMetadata,
|
||||
type ActorMetadata,
|
||||
FieldMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
type RichTextV2Metadata,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||
|
||||
import { IndexType } from 'src/engine/metadata-modules/index-metadata/types/indexType.types';
|
||||
import { SEARCH_VECTOR_FIELD } from 'src/engine/metadata-modules/search-field-metadata/constants/search-vector-field.constants';
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
import { WorkspaceFieldIndex } from 'src/engine/twenty-orm/decorators/workspace-field-index.decorator';
|
||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||
import { WorkspaceIsFieldUIReadOnly } from 'src/engine/twenty-orm/decorators/workspace-is-field-ui-readonly.decorator';
|
||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||
import { WorkspaceIsSearchable } from 'src/engine/twenty-orm/decorators/workspace-is-searchable.decorator';
|
||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { NOTE_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import {
|
||||
type FieldTypeAndNameMetadata,
|
||||
getTsVectorColumnExpressionFromFields,
|
||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/utils/get-ts-vector-column-expression.util';
|
||||
import { AttachmentWorkspaceEntity } from 'src/modules/attachment/standard-objects/attachment.workspace-entity';
|
||||
import { FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/favorite.workspace-entity';
|
||||
import { NoteTargetWorkspaceEntity } from 'src/modules/note/standard-objects/note-target.workspace-entity';
|
||||
import { TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
import { type FieldTypeAndNameMetadata } from 'src/engine/workspace-manager/utils/get-ts-vector-column-expression.util';
|
||||
import { type EntityRelation } from 'src/engine/workspace-manager/workspace-migration/types/entity-relation.interface';
|
||||
import { type AttachmentWorkspaceEntity } from 'src/modules/attachment/standard-objects/attachment.workspace-entity';
|
||||
import { type FavoriteWorkspaceEntity } from 'src/modules/favorite/standard-objects/favorite.workspace-entity';
|
||||
import { type NoteTargetWorkspaceEntity } from 'src/modules/note/standard-objects/note-target.workspace-entity';
|
||||
import { type TimelineActivityWorkspaceEntity } from 'src/modules/timeline/standard-objects/timeline-activity.workspace-entity';
|
||||
|
||||
const TITLE_FIELD_NAME = 'title';
|
||||
const BODY_V2_FIELD_NAME = 'bodyV2';
|
||||
@@ -40,135 +20,15 @@ export const SEARCH_FIELDS_FOR_NOTES: FieldTypeAndNameMetadata[] = [
|
||||
{ name: BODY_V2_FIELD_NAME, type: FieldMetadataType.RICH_TEXT_V2 },
|
||||
];
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.note,
|
||||
|
||||
namePlural: 'notes',
|
||||
labelSingular: msg`Note`,
|
||||
labelPlural: msg`Notes`,
|
||||
description: msg`A note`,
|
||||
icon: STANDARD_OBJECT_ICONS.note,
|
||||
shortcut: 'N',
|
||||
labelIdentifierStandardId: NOTE_STANDARD_FIELD_IDS.title,
|
||||
})
|
||||
@WorkspaceIsSearchable()
|
||||
export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.position,
|
||||
type: FieldMetadataType.POSITION,
|
||||
label: msg`Position`,
|
||||
description: msg`Note record position`,
|
||||
icon: 'IconHierarchy2',
|
||||
defaultValue: 0,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
position: number;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.title,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Title`,
|
||||
description: msg`Note title`,
|
||||
icon: 'IconNotes',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
title: string;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.bodyV2,
|
||||
type: FieldMetadataType.RICH_TEXT_V2,
|
||||
label: msg`Body`,
|
||||
description: msg`Note body`,
|
||||
icon: 'IconFilePencil',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
bodyV2: RichTextV2Metadata | null;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.createdBy,
|
||||
type: FieldMetadataType.ACTOR,
|
||||
label: msg`Created by`,
|
||||
icon: 'IconCreativeCommonsSa',
|
||||
description: msg`The creator of the record`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
createdBy: ActorMetadata;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.updatedBy,
|
||||
type: FieldMetadataType.ACTOR,
|
||||
label: msg`Updated by`,
|
||||
icon: 'IconUserCircle',
|
||||
description: msg`The workspace member who last updated the record`,
|
||||
})
|
||||
@WorkspaceIsFieldUIReadOnly()
|
||||
updatedBy: ActorMetadata;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.noteTargets,
|
||||
label: msg`Relations`,
|
||||
description: msg`Note targets`,
|
||||
icon: 'IconArrowUpRight',
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
inverseSideTarget: () => NoteTargetWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
noteTargets: Relation<NoteTargetWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.attachments,
|
||||
label: msg`Attachments`,
|
||||
description: msg`Note attachments`,
|
||||
icon: 'IconFileImport',
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
inverseSideTarget: () => AttachmentWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
attachments: Relation<AttachmentWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.timelineActivities,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Timeline Activities`,
|
||||
description: msg`Timeline Activities linked to the note.`,
|
||||
icon: 'IconTimelineEvent',
|
||||
inverseSideTarget: () => TimelineActivityWorkspaceEntity,
|
||||
inverseSideFieldKey: 'targetNote',
|
||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
timelineActivities: Relation<TimelineActivityWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.favorites,
|
||||
type: RelationType.ONE_TO_MANY,
|
||||
label: msg`Favorites`,
|
||||
description: msg`Favorites linked to the note`,
|
||||
icon: 'IconHeart',
|
||||
inverseSideTarget: () => FavoriteWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsSystem()
|
||||
favorites: Relation<FavoriteWorkspaceEntity[]>;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: NOTE_STANDARD_FIELD_IDS.searchVector,
|
||||
type: FieldMetadataType.TS_VECTOR,
|
||||
label: SEARCH_VECTOR_FIELD.label,
|
||||
description: SEARCH_VECTOR_FIELD.description,
|
||||
icon: 'IconUser',
|
||||
generatedType: 'STORED',
|
||||
asExpression: getTsVectorColumnExpressionFromFields(
|
||||
SEARCH_FIELDS_FOR_NOTES,
|
||||
),
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
noteTargets: EntityRelation<NoteTargetWorkspaceEntity[]>;
|
||||
attachments: EntityRelation<AttachmentWorkspaceEntity[]>;
|
||||
timelineActivities: EntityRelation<TimelineActivityWorkspaceEntity[]>;
|
||||
favorites: EntityRelation<FavoriteWorkspaceEntity[]>;
|
||||
searchVector: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user