Backfill workspace favorites (#7122)

- command to backfill workspace favorites
- create workspace favorites on workspace activation
- create workspace favorites on demo seed

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Thomas Trompette
2024-09-18 18:26:55 +02:00
committed by GitHub
parent 759eb3070e
commit b1cb8998f8
12 changed files with 250 additions and 40 deletions
@@ -1,8 +1,6 @@
import { EntityManager } from 'typeorm';
import { v4 } from 'uuid';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { companiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view';
import { notesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/notes-all.view';
@@ -17,13 +15,8 @@ export const viewPrefillData = async (
entityManager: EntityManager,
schemaName: string,
objectMetadataMap: Record<string, ObjectMetadataEntity>,
featureFlags?: FeatureFlagEntity[],
isWorkflowEnabled: boolean,
) => {
const isWorkflowEnabled =
featureFlags?.find(
(featureFlag) => featureFlag.key === FeatureFlagKey.IsWorkflowEnabled,
)?.value ?? false;
const viewDefinitions = [
await companiesAllView(objectMetadataMap),
await peopleAllView(objectMetadataMap),