feat: add endpoints for graphql api #108
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check out my loom here: https://www.loom.com/share/5a05f62b1e08487897e4039ff774ee58
Description
This PR introduces changes to the GraphQL API to support the feature flag service and adds two mutations and one query. The schema, mutations, queries, and resolvers have been updated to manage feature flags for users, fetch all users with their associated feature flags, and update feature flag assignments for a specific user. These changes enable better feature flag management in the application, allowing clients to easily assign, retrieve, and update feature flag values for users.
Changes
Added a new query allUsersWithFeatureFlags to fetch all users and their associated feature flags.
Implemented a new mutation assignFeatureFlagToUsers to target one or more users with a specific feature flag.
Implemented a new mutation updateFeatureFlagAssignment to change the value of a feature flag for a specific user.
Updated resolvers to process SQL query results, create the hierarchical data structure, and handle new mutations and queries.
Areas for Improvement
Add error handling and validation: Enhance the GraphQL resolvers to handle potential errors and validate input data.
Implement pagination: Introduce pagination support for the allUsersWithFeatureFlags query to handle large datasets efficiently and improve API response times.
Concluding Thoughts
The changes introduced in this PR provide a solid foundation for managing user-feature flag relationships in the GraphQL API. By implementing these updates, clients can easily assign, retrieve, and update feature flag values for users, improving the overall feature flag management experience. Future enhancements should focus on optimizing performance, adding error handling and validation.