942d2fef83
# 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 )
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import {
|
|
type DynamicModule,
|
|
Global,
|
|
Module,
|
|
type Provider,
|
|
} from '@nestjs/common';
|
|
|
|
import { capitalize } from 'twenty-shared/utils';
|
|
|
|
import { metadataToRepositoryMapping } from 'src/engine/object-metadata-repository/metadata-to-repository.mapping';
|
|
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
|
|
import { TwentyORMModule } from 'src/engine/twenty-orm/twenty-orm.module';
|
|
import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module';
|
|
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/utils/convert-class-to-object-metadata-name.util';
|
|
|
|
@Global()
|
|
@Module({})
|
|
export class ObjectMetadataRepositoryModule {
|
|
// @ts-expect-error legacy noImplicitAny
|
|
static forFeature(objectMetadatas): DynamicModule {
|
|
// @ts-expect-error legacy noImplicitAny
|
|
const providers: Provider[] = objectMetadatas.map((objectMetadata) => {
|
|
// @ts-expect-error legacy noImplicitAny
|
|
const repositoryClass = metadataToRepositoryMapping[objectMetadata.name];
|
|
|
|
if (!repositoryClass) {
|
|
throw new Error(`No repository found for ${objectMetadata.name}`);
|
|
}
|
|
|
|
return {
|
|
provide: `${capitalize(
|
|
convertClassNameToObjectMetadataName(objectMetadata.name),
|
|
)}Repository`,
|
|
useFactory: (globalWorkspaceOrmManager: GlobalWorkspaceOrmManager) => {
|
|
return new repositoryClass(globalWorkspaceOrmManager);
|
|
},
|
|
inject: [GlobalWorkspaceOrmManager],
|
|
};
|
|
});
|
|
|
|
return {
|
|
module: ObjectMetadataRepositoryModule,
|
|
imports: [WorkspaceDataSourceModule, TwentyORMModule],
|
|
providers: [...providers],
|
|
exports: providers,
|
|
};
|
|
}
|
|
}
|