Add workspace favorites behind feature flag (#6904)
- make member nullable on favorites - add potential relation with view entity - add a new type of favorite list in front : workspace favorite - build a new component for retrieving workspace favorite to display + refacto the existing one Bonus: - removing activities seed since this is deprecated
This commit is contained in:
@ -18,6 +18,7 @@ import { seedCalendarEventParticipants } from 'src/database/typeorm-seeds/worksp
|
||||
import { seedCalendarEvents } from 'src/database/typeorm-seeds/workspace/calendar-events';
|
||||
import { seedCompanies } from 'src/database/typeorm-seeds/workspace/companies';
|
||||
import { seedConnectedAccount } from 'src/database/typeorm-seeds/workspace/connected-account';
|
||||
import { seedWorkspaceFavorites } from 'src/database/typeorm-seeds/workspace/favorites';
|
||||
import { seedMessageChannelMessageAssociation } from 'src/database/typeorm-seeds/workspace/message-channel-message-associations';
|
||||
import { seedMessageChannel } from 'src/database/typeorm-seeds/workspace/message-channels';
|
||||
import { seedMessageParticipant } from 'src/database/typeorm-seeds/workspace/message-participants';
|
||||
@ -206,12 +207,18 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
|
||||
);
|
||||
}
|
||||
|
||||
await viewPrefillData(
|
||||
const viewDefinitionsWithId = await viewPrefillData(
|
||||
entityManager,
|
||||
dataSourceMetadata.schema,
|
||||
objectMetadataMap,
|
||||
featureFlags,
|
||||
);
|
||||
|
||||
await seedWorkspaceFavorites(
|
||||
viewDefinitionsWithId.map((view) => view.id),
|
||||
entityManager,
|
||||
dataSourceMetadata.schema,
|
||||
);
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
|
||||
@ -50,6 +50,11 @@ export const seedFeatureFlags = async (
|
||||
workspaceId: workspaceId,
|
||||
value: false,
|
||||
},
|
||||
{
|
||||
key: FeatureFlagKey.IsWorkspaceFavoriteEnabled,
|
||||
workspaceId: workspaceId,
|
||||
value: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
import { EntityManager } from 'typeorm';
|
||||
import { v4 } from 'uuid';
|
||||
|
||||
const tableName = 'favorite';
|
||||
|
||||
export const seedWorkspaceFavorites = async (
|
||||
viewIds: string[],
|
||||
entityManager: EntityManager,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await entityManager
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, ['id', 'viewId', 'position'])
|
||||
.values(
|
||||
viewIds.map((viewId, index) => ({
|
||||
id: v4(),
|
||||
viewId,
|
||||
position: index,
|
||||
})),
|
||||
)
|
||||
.execute();
|
||||
};
|
||||
Reference in New Issue
Block a user