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

Fix GraphQL Api Setters not being applied #7602

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Oct 11, 2024

While rebuilding the new GraphQLAPI (without pg_graphql), we forgot to include the FieldGetter logic. This logic will soon be moved at ORM level but we will need to keep it there for now

The bug has many impacts such as the fileToken not being generated and preventing users from loading files

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 addresses a critical oversight in the new GraphQL API implementation, reintroducing the FieldGetter logic that was inadvertently omitted during the rebuild.

  • Added QueryResultGettersFactory to GraphqlQueryRunnerService in packages/twenty-server/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.ts
  • Modified executeQuery method to apply getters to query results before returning
  • Ensures consistent application of FieldGetter logic across all query results
  • Temporary solution until the logic is moved to the ORM level
  • Maintains API behavior consistency during the transition to the new GraphQL API structure

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +368 to +370
Array.isArray(resultWithGetters)
? resultWithGetters
: [resultWithGetters],
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider moving this array check to a separate utility function for better readability and reusability.

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

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

LGTM

@charlesBochet charlesBochet merged commit 0980d6d into main Oct 11, 2024
7 of 8 checks passed
@charlesBochet charlesBochet deleted the fix-api-getters-not-applied branch October 11, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants