Treat suspended workspace as workspaces that need to be synced (#9669)
In this PR: - migrate WorkspaceActivationStatus to twenty-shared (and update case to make FE and BE consistent) - introduce isWorkspaceActiveOrSuspended in twenty-shared - refactor the code to use it (when we fetch data on the FE, we want to keep SUSPENDED workspace working + when we sync workspaces we want it too)
This commit is contained in:
@ -1,16 +1,13 @@
|
||||
import chalk from 'chalk';
|
||||
import { Option } from 'nest-commander';
|
||||
import { Repository } from 'typeorm';
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared';
|
||||
import { In, Repository } from 'typeorm';
|
||||
|
||||
import {
|
||||
BaseCommandOptions,
|
||||
BaseCommandRunner,
|
||||
} from 'src/database/commands/base.command';
|
||||
import {
|
||||
Workspace,
|
||||
WorkspaceActivationStatus,
|
||||
} from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
export type ActiveWorkspacesCommandOptions = BaseCommandOptions & {
|
||||
workspaceId?: string;
|
||||
};
|
||||
@ -38,7 +35,10 @@ export abstract class ActiveWorkspacesCommandRunner extends BaseCommandRunner {
|
||||
const activeWorkspaces = await this.workspaceRepository.find({
|
||||
select: ['id'],
|
||||
where: {
|
||||
activationStatus: WorkspaceActivationStatus.ACTIVE,
|
||||
activationStatus: In([
|
||||
WorkspaceActivationStatus.ACTIVE,
|
||||
WorkspaceActivationStatus.SUSPENDED,
|
||||
]),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { Command, Option } from 'nest-commander';
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared';
|
||||
import { In, Repository } from 'typeorm';
|
||||
|
||||
import {
|
||||
@ -16,10 +17,7 @@ import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-
|
||||
import { KeyValuePair } from 'src/engine/core-modules/key-value-pair/key-value-pair.entity';
|
||||
import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity';
|
||||
import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import {
|
||||
Workspace,
|
||||
WorkspaceActivationStatus,
|
||||
} from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
||||
import { WorkspaceMigrationEntity } from 'src/engine/metadata-modules/workspace-migration/workspace-migration.entity';
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared';
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { WorkspaceActivationStatus } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
|
||||
const tableName = 'workspace';
|
||||
|
||||
export const seedWorkspaces = async (
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared';
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import {
|
||||
Workspace,
|
||||
WorkspaceActivationStatus,
|
||||
} from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
|
||||
const tableName = 'workspace';
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ export const seedMessageChannel = async (
|
||||
'type',
|
||||
'connectedAccountId',
|
||||
'handle',
|
||||
'isSyncEnabled',
|
||||
'visibility',
|
||||
'syncStage',
|
||||
])
|
||||
@ -46,7 +47,7 @@ export const seedMessageChannel = async (
|
||||
handle: 'tim@apple.dev',
|
||||
isSyncEnabled: false,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.JONY,
|
||||
@ -59,7 +60,7 @@ export const seedMessageChannel = async (
|
||||
handle: 'jony.ive@apple.dev',
|
||||
isSyncEnabled: false,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: DEV_SEED_MESSAGE_CHANNEL_IDS.PHIL,
|
||||
@ -72,7 +73,7 @@ export const seedMessageChannel = async (
|
||||
handle: 'phil.schiler@apple.dev',
|
||||
isSyncEnabled: false,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncSubStatus: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
Reference in New Issue
Block a user