Revert "Revert "[4/n]: migrate the RESTAPI GET /rest/* to use TwentyORM direc…" (#11349)

This commit is contained in:
martmull
2025-05-12 10:32:04 +02:00
committed by GitHub
parent 1f4d4c5265
commit 650f8f5963
50 changed files with 1532 additions and 698 deletions

View File

@ -6,6 +6,8 @@ import { GraphQLSchema, printSchema } from 'graphql';
import { gql } from 'graphql-tag';
import { isDefined } from 'twenty-shared/utils';
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
import {
GraphqlQueryRunnerException,
GraphqlQueryRunnerExceptionCode,
@ -21,6 +23,7 @@ import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-
import { ObjectMetadataMaps } from 'src/engine/metadata-modules/types/object-metadata-maps';
import { WorkspaceMetadataCacheService } from 'src/engine/metadata-modules/workspace-metadata-cache/services/workspace-metadata-cache.service';
import { WorkspaceCacheStorageService } from 'src/engine/workspace-cache-storage/workspace-cache-storage.service';
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
@Injectable()
export class WorkspaceSchemaFactory {
@ -32,6 +35,7 @@ export class WorkspaceSchemaFactory {
private readonly workspaceCacheStorageService: WorkspaceCacheStorageService,
private readonly workspaceMetadataCacheService: WorkspaceMetadataCacheService,
private readonly featureFlagService: FeatureFlagService,
private readonly twentyConfigService: TwentyConfigService,
) {}
async createGraphQLSchema(authContext: AuthContext): Promise<GraphQLSchema> {
@ -44,7 +48,10 @@ export class WorkspaceSchemaFactory {
authContext.workspace.id,
);
if (isNewRelationEnabled) {
if (
isNewRelationEnabled &&
this.twentyConfigService.get('NODE_ENV') !== NodeEnvironment.test
) {
// eslint-disable-next-line no-console
console.log(
chalk.yellow('🚧 New relation schema generation is enabled 🚧'),