-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add DestroyMany to graphql query runner #7507
Add DestroyMany to graphql query runner #7507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request introduces a new 'destroyMany' operation to the GraphQL query runner, enabling bulk deletion of records. The changes are consistent with the existing codebase structure but introduce more powerful deletion capabilities.
- Added new GraphqlQueryDestroyManyResolverService for handling bulk deletions in
/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/resolvers/graphql-query-destroy-many-resolver.service.ts
- Implemented 'destroyMany' method in GraphqlQueryRunnerService class in
/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts
- Updated GraphqlQueryResolverFactory to support 'destroyMany' operation in
/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/factories/graphql-query-resolver.factory.ts
- Introduced feature flag 'IsQueryRunnerTwentyORMEnabled' for conditional usage of new GraphQL query runner service in
/packages/twenty-server/src/engine/api/graphql/workspace-resolver-builder/factories/destroy-many-resolver.factory.ts
- Refactored GraphqlQueryDestroyOneResolverService for improved error handling and relation processing in
/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/resolvers/graphql-query-destroy-one-resolver.service.ts
7 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings
if (relations) { | ||
await processNestedRelationsHelper.processNestedRelations( | ||
objectMetadataMap, | ||
objectMetadataMapItem, | ||
deletedRecords, | ||
relations, | ||
QUERY_MAX_RECORDS, | ||
authContext, | ||
dataSource, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Processing nested relations after deletion might lead to inconsistencies. Consider handling this before deletion or removing it if not necessary
if (relations) { | ||
await processNestedRelationsHelper.processNestedRelations( | ||
objectMetadataMap, | ||
objectMetadataMapItem, | ||
[recordBeforeDeletion], | ||
relations, | ||
QUERY_MAX_RECORDS, | ||
authContext, | ||
dataSource, | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Processing nested relations after deletion might lead to inconsistencies if related records were also deleted. Consider handling this scenario.
return typeORMObjectRecordsParser.processRecord( | ||
recordBeforeDeletion, | ||
objectMetadataMapItem.nameSingular, | ||
1, | ||
1, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Hardcoding '1' for totalCount and pageCount may be incorrect if used in pagination context. Consider using actual values or removing if unnecessary.
## Context destroyMany was not implemented, this PR adds it
Context
destroyMany was not implemented, this PR adds it