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

Refactor graphql query runner and add mutation resolvers #7418

Merged
merged 24 commits into from
Oct 4, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Oct 3, 2024

Fixes #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...)

@Weiko Weiko marked this pull request as ready for review October 3, 2024 16:53
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Comment on lines +124 to +126
if (value && typeof value === 'object' && value['edges']) {
continue;
}
Copy link
Contributor

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.

@Weiko Weiko merged commit 511150a into main Oct 4, 2024
5 of 6 checks passed
@Weiko Weiko deleted the c--refactor-graphql-query-runner-mutations branch October 4, 2024 09:58
@charlesBochet charlesBochet mentioned this pull request Oct 7, 2024
4 tasks
harshit078 pushed a commit to harshit078/twenty that referenced this pull request Oct 14, 2024
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...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pg_graphql deprecation
1 participant