Skip to content

Commit

Permalink
Remove graphql twenty orm feature flag (#7556)
Browse files Browse the repository at this point in the history
## Context
IS_QUERY_RUNNER_TWENTY_ORM_ENABLED has been fully launched in 0.31.0,
the feature flag can be safely removed.

Note: Waiting for 0.31.1
  • Loading branch information
Weiko authored Oct 10, 2024
1 parent a58236e commit 66a483c
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,12 @@ export const CommandMenu = () => {
[closeCommandMenu],
);

const isTwentyOrmEnabled = useIsFeatureEnabled(
'IS_QUERY_RUNNER_TWENTY_ORM_ENABLED',
);

const isWorkspaceMigratedForSearch = useIsFeatureEnabled(
'IS_WORKSPACE_MIGRATED_FOR_SEARCH',
);

const isSearchEnabled =
useIsFeatureEnabled('IS_SEARCH_ENABLED') &&
isTwentyOrmEnabled &&
isWorkspaceMigratedForSearch;
useIsFeatureEnabled('IS_SEARCH_ENABLED') && isWorkspaceMigratedForSearch;

const { records: peopleFromFindMany } = useFindManyRecords<Person>({
skip: !isCommandMenuOpened || isSearchEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ export const seedFeatureFlags = async (
workspaceId: workspaceId,
value: false,
},
{
key: FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
workspaceId: workspaceId,
value: true,
},
{
key: FeatureFlagKey.IsSearchEnabled,
workspaceId: workspaceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,9 @@ export class GraphqlQuerySearchResolverService
options.authContext.workspace.id,
);

const isQueryRunnerTwentyORMEnabled =
featureFlagsForWorkspace.IS_QUERY_RUNNER_TWENTY_ORM_ENABLED;

const isSearchEnabled = featureFlagsForWorkspace.IS_SEARCH_ENABLED;

if (!isQueryRunnerTwentyORMEnabled || !isSearchEnabled) {
if (!isSearchEnabled) {
throw new GraphqlQueryRunnerException(
'This endpoint is not available yet, please use findMany instead.',
GraphqlQueryRunnerExceptionCode.INVALID_QUERY_INPUT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class CreateManyResolverFactory
Expand All @@ -21,8 +18,6 @@ export class CreateManyResolverFactory
public static methodName = 'createMany' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,17 +38,7 @@ export class CreateManyResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.createMany(args, options);
}

return await this.workspaceQueryRunnerService.createMany(args, options);
return await this.graphqlQueryRunnerService.createMany(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class CreateOneResolverFactory
Expand All @@ -21,8 +18,6 @@ export class CreateOneResolverFactory
public static methodName = 'createOne' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,17 +38,7 @@ export class CreateOneResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.createOne(args, options);
}

return await this.workspaceQueryRunnerService.createOne(args, options);
return await this.graphqlQueryRunnerService.createOne(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class DeleteManyResolverFactory
Expand All @@ -21,8 +18,6 @@ export class DeleteManyResolverFactory
public static methodName = 'deleteMany' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,17 +38,7 @@ export class DeleteManyResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.deleteMany(args, options);
}

return await this.workspaceQueryRunnerService.deleteMany(args, options);
return await this.graphqlQueryRunnerService.deleteMany(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class DeleteOneResolverFactory
Expand All @@ -21,8 +18,6 @@ export class DeleteOneResolverFactory
public static methodName = 'deleteOne' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,17 +38,7 @@ export class DeleteOneResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.deleteOne(args, options);
}

return await this.workspaceQueryRunnerService.deleteOne(args, options);
return await this.graphqlQueryRunnerService.deleteOne(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class DestroyManyResolverFactory
Expand All @@ -21,8 +18,6 @@ export class DestroyManyResolverFactory
public static methodName = 'destroyMany' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,23 +38,7 @@ export class DestroyManyResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.destroyMany(
args,
options,
);
}

return await this.workspaceQueryRunnerService.destroyMany(
args,
options,
);
return await this.graphqlQueryRunnerService.destroyMany(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class FindDuplicatesResolverFactory
Expand All @@ -21,8 +18,6 @@ export class FindDuplicatesResolverFactory
public static methodName = 'findDuplicates' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,20 +38,7 @@ export class FindDuplicatesResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.findDuplicates(
args,
options,
);
}

return await this.workspaceQueryRunnerService.findDuplicates(
return await this.graphqlQueryRunnerService.findDuplicates(
args,
options,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class RestoreManyResolverFactory
Expand All @@ -21,8 +18,6 @@ export class RestoreManyResolverFactory
public static methodName = 'restoreMany' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,23 +38,7 @@ export class RestoreManyResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.restoreMany(
args,
options,
);
}

return await this.workspaceQueryRunnerService.restoreMany(
args,
options,
);
return await this.graphqlQueryRunnerService.restoreMany(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import { WorkspaceSchemaBuilderContext } from 'src/engine/api/graphql/workspace-

import { GraphqlQueryRunnerService } from 'src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service';
import { workspaceQueryRunnerGraphqlApiExceptionHandler } from 'src/engine/api/graphql/workspace-query-runner/utils/workspace-query-runner-graphql-api-exception-handler.util';
import { WorkspaceQueryRunnerService } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service';
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';

@Injectable()
export class UpdateManyResolverFactory
Expand All @@ -21,8 +18,6 @@ export class UpdateManyResolverFactory
public static methodName = 'updateMany' as const;

constructor(
private readonly workspaceQueryRunnerService: WorkspaceQueryRunnerService,
private readonly featureFlagService: FeatureFlagService,
private readonly graphqlQueryRunnerService: GraphqlQueryRunnerService,
) {}

Expand All @@ -43,17 +38,7 @@ export class UpdateManyResolverFactory
objectMetadataMapItem: internalContext.objectMetadataMapItem,
};

const isQueryRunnerTwentyORMEnabled =
await this.featureFlagService.isFeatureEnabled(
FeatureFlagKey.IsQueryRunnerTwentyORMEnabled,
internalContext.authContext.workspace.id,
);

if (isQueryRunnerTwentyORMEnabled) {
return await this.graphqlQueryRunnerService.updateMany(args, options);
}

return await this.workspaceQueryRunnerService.updateMany(args, options);
return await this.graphqlQueryRunnerService.updateMany(args, options);
} catch (error) {
workspaceQueryRunnerGraphqlApiExceptionHandler(error);
}
Expand Down
Loading

0 comments on commit 66a483c

Please sign in to comment.