-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Refactor graphql query runner and add mutation resolvers #7418
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.
PR Summary
This pull request implements significant refactoring and enhancements to the GraphQL query runner and mutation resolvers in the Twenty server.
- Introduced new resolver services for create, update, delete, and destroy operations, improving modularity and maintainability
- Implemented a GraphqlQueryResolverFactory to centralize resolver creation and simplify adding new resolvers
- Added ApiEventEmitterService to handle event emission for various database operations
- Refactored existing resolvers to use dependency injection and implement a common ResolverService interface
- Updated WorkspaceQueryRunnerOptions to include objectMetadataMap, potentially improving performance by reducing metadata computations
30 file(s) reviewed, 11 comment(s)
Edit PR Review Bot Settings
...rver/src/engine/api/graphql/graphql-query-runner/factories/graphql-query-resolver.factory.ts
Outdated
Show resolved
Hide resolved
...es/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts
Show resolved
Hide resolved
...erver/src/engine/api/graphql/graphql-query-runner/helpers/process-nested-relations.helper.ts
Outdated
Show resolved
Hide resolved
...ine/api/graphql/graphql-query-runner/resolvers/graphql-query-destroy-one-resolver.service.ts
Show resolved
Hide resolved
...api/graphql/graphql-query-runner/resolvers/graphql-query-find-duplicates-resolver.service.ts
Outdated
Show resolved
Hide resolved
...ine/api/graphql/graphql-query-runner/resolvers/graphql-query-update-many-resolver.service.ts
Outdated
Show resolved
Hide resolved
...gine/api/graphql/graphql-query-runner/resolvers/graphql-query-update-one-resolver.service.ts
Outdated
Show resolved
Hide resolved
...nty-server/src/engine/api/graphql/graphql-query-runner/services/api-event-emitter.service.ts
Outdated
Show resolved
Hide resolved
if (value && typeof value === 'object' && value['edges']) { | ||
continue; | ||
} |
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.
style: This check might miss other nested objects without 'edges'. Consider a more robust approach for identifying and handling nested structures.
.../src/engine/api/graphql/workspace-resolver-builder/factories/delete-many-resolver.factory.ts
Show resolved
Hide resolved
Fixes twentyhq#6859 This PR adds all the remaining resolvers for - updateOne/updateMany - createOne/createMany - deleteOne/deleteMany - destroyOne - restoreMany Also - refactored the graphql-query-runner to be able to add other resolvers without too much boilerplate. - add missing events that were not sent anymore as well as webhooks - make resolver injectable so they can inject other services as well - use objectMetadataMap from cache instead of computing it multiple time - various fixes (mutation not correctly parsing JSON, relationHelper fetching data with empty ids set, ...) Next steps: - Wrapping query builder to handle DB events properly - Move webhook emitters to db event listener - Add pagination where it's missing (findDuplicates, nested relations, etc...)
Fixes #6859
This PR adds all the remaining resolvers for
Also
Next steps: