Skip to content

Update resolvers to use state change's toID and order #274

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

Merged
merged 7 commits into from
Aug 11, 2025

Conversation

aditya1702
Copy link
Contributor

@aditya1702 aditya1702 commented Aug 9, 2025

What

  • Change all relevant resolvers and data models to use the (to_id, state_change_order) primary key for state change.
  • Change all relevant tests.

Why

We recently added a new primary key to uniquely identify state changes. The to_id, state_change_order now acts as the ID for a state change.

Known limitations

N/A

Checklist

PR Structure

  • It is not possible to break this PR down into smaller PRs.
  • This PR does not mix refactoring changes with feature changes.
  • This PR's title starts with name of package that is most changed in the PR, or all if the changes are broad or impact many packages.

Thoroughness

  • This PR adds tests for the new functionality or fixes.
  • All updated queries have been tested (refer to this check if the data set returned by the updated query is expected to be same as the original one).

Release

  • This is not a breaking change.
  • This is ready to be tested in development.
  • The new functionality is gated with a feature flag if this is not ready for production.

Introduces a custom resolver for the StateChange.id field, generating a composite ID from ToID and StateChangeOrder for compatibility. Updates all relevant tests and loader keys to use the new composite ID, and modifies the GraphQL schema to require the resolver for the id field.
Eliminates the 'id' field from the StateChange GraphQL type, its resolver, and all associated complexity and execution logic. Updates tests to no longer reference or expect the 'id' field, focusing instead on 'accountId' and 'stateChangeCategory'. This simplifies the schema and code by removing the composite ID previously generated from ToID and StateChangeOrder.
Updated operations and transactions logic to use (to_id, state_change_order) composite keys instead of single string IDs for state changes. Modified related queries, test data, and dataloader logic to support this change. Added a utility function to parse composite state change IDs.
Changed the StateChange.operation field from non-nullable to nullable in the GraphQL schema and regenerated code accordingly. This allows StateChange objects to have a null operation, improving flexibility in the API.
Modified StateChangeModel to always return to_id and state_change_order as primary keys and updated the query ordering. Improved the Clone method in StateChangeBuilder for correctness. Clarified in the GraphQL schema and generated code that the operation field is nullable for fee state changes.
@aditya1702 aditya1702 changed the base branch from main to graphql-main August 9, 2025 04:01
@aditya1702 aditya1702 marked this pull request as ready for review August 11, 2025 14:25
@aditya1702 aditya1702 requested a review from akcays August 11, 2025 14:25
@aditya1702 aditya1702 merged commit daa299e into graphql-main Aug 11, 2025
6 checks passed
@aditya1702 aditya1702 deleted the fix-tests branch August 11, 2025 18:11
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.

2 participants