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] generateDepthOneRecordGqlFieldsFromRecord #10499

Merged

Conversation

prastoin
Copy link
Contributor

@prastoin prastoin commented Feb 26, 2025

Introduction

This refactor results from this #10493 review
Introduced a new abstraction to the extinsting generateDepthOneRecordGqlFields that was accepting an optional record in arg in order to map generated recordGqlFields to the keys in the record

1/ Created a dedicated util method generateDepthOneRecordGqlFieldsFromRecord to do so
2/ Updated each previous generateDepthOneRecordGqlFields passing a record to call new generateDepthOneRecordGqlFieldsFromRecord

@prastoin prastoin force-pushed the prastoin-refactor-generator-one-depth-record-gql-fields branch from 633fc34 to c994504 Compare February 26, 2025 10:49
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 PR refactors the GraphQL field generation utilities by extracting record-specific functionality into a dedicated function.

  • Created new generateDepthOneRecordGqlFieldsFromRecord utility that extends generateDepthOneRecordGqlFields to handle record-specific field mapping
  • Simplified generateDepthOneRecordGqlFields to only generate fields from object metadata, returning Record<string, true>
  • Updated all existing calls throughout the codebase to use the appropriate function based on whether a record is involved
  • Added comprehensive tests for the new utility function in generateDepthOneRecordGqlFieldsFromRecord.test.ts
  • Improved code organization by separating concerns, making each function focused on a single responsibility

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

@prastoin prastoin enabled auto-merge (squash) February 26, 2025 11:05
@prastoin prastoin merged commit ec87218 into main Feb 26, 2025
47 checks passed
@prastoin prastoin deleted the prastoin-refactor-generator-one-depth-record-gql-fields branch February 26, 2025 11:11
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