Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove graphql twenty orm feature flag #7556

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Comment on lines 170 to +175
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Search enablement now only depends on 'IS_SEARCH_ENABLED' and 'IS_WORKSPACE_MIGRATED_FOR_SEARCH'. Ensure this doesn't unintentionally enable search for environments where it shouldn't be.


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
Loading