ecs - full redesign using golang backend graphql#3
Open
ecshreve wants to merge 4 commits intoecs/graphqlfrom
Open
ecs - full redesign using golang backend graphql#3ecshreve wants to merge 4 commits intoecs/graphqlfrom
ecshreve wants to merge 4 commits intoecs/graphqlfrom
Conversation
e8f8022 to
70fa9b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Frontend
The frontend is a React application that uses Apollo Client to interact with the GraphQL backend. It's built with TypeScript and React.
Overview
graph TD App[App Component] Home[Home Page] Filters[Filters Component] MessageList[MessageList Component] MessageItem[MessageItem Component] Apollo[Apollo Client] GraphQL[GraphQL Backend] Cache[Apollo Cache] Mutations[GraphQL Mutations] Queries[GraphQL Queries] App --> Home Home --> Filters Home --> MessageList MessageList --> MessageItem Home -->|Uses| Queries Home -->|Uses| Mutations Queries -->|Fetches data via| Apollo Mutations -->|Sends data via| Apollo Apollo --> GraphQL Apollo --> Cache Mutations -->|Updates data in| Cache Queries -->|Reads data from| CachePlanned frontend data flow
sequenceDiagram participant User participant Home participant ApolloClient participant GraphQLBackend participant ApolloCache participant MessageList participant MessageItem User->>Home: Apply Filters (e.g., Starred, Sender) Home->>ApolloClient: Execute GET_MESSAGES Query with Filters ApolloClient->>GraphQLBackend: Send Query Request GraphQLBackend-->>ApolloClient: Return Query Response ApolloClient->>ApolloCache: Update Cache with Messages ApolloClient-->>Home: Return Messages Data Home->>MessageList: Pass Messages to Display MessageList->>MessageItem: Render Each Message User->>MessageItem: Click Star/Unstar on a Message MessageItem->>Home: Trigger TOGGLE_STARRED Mutation Home->>ApolloClient: Execute TOGGLE_STARRED Mutation with Message ID ApolloClient->>GraphQLBackend: Send Mutation Request GraphQLBackend-->>ApolloClient: Return Mutation Response ApolloClient->>ApolloCache: Update Cache with New Star Status ApolloClient-->>Home: Return Updated Message Data Home->>MessageList: Update Message in Display MessageList->>MessageItem: Reflect Star Status ChangeBackend Services
The backend is a GraphQL server implemented in Go. It uses a resolver to fetch data from a Redis cache and a PostgreSQL database. Also handles interactions with the Gmail API.
Overview
graph TD subgraph TD GraphQL Server Resolver[Resolvers] Schema[GraphQL Schema] end subgraph Services GmailClient[Gmail Client] Cache[Redis Cache] Database[PostgreSQL Database] end subgraph External Services GmailAPI[Gmail REST API] end Resolver --> Schema Resolver -->|Fetch/Store Data| Database Resolver -->|Cache Operations| Cache Resolver -->|Gmail Operations| GmailClient GmailClient -->|API Requests| GmailAPIBackend data flow
sequenceDiagram participant Frontend as Apollo Client participant GraphQL as GraphQL Server participant Resolver as Resolvers participant Cache as Redis Cache participant Database as PostgreSQL Database participant GmailClient as Gmail Client participant GmailAPI as Gmail REST API Frontend->>GraphQL: Send GetMessages Query (with filters) GraphQL->>Resolver: Resolve GetMessages Resolver->>Cache: Check Cache for Messages alt Cache Hit Cache-->>Resolver: Return Cached Messages else Cache Miss Resolver->>Database: Query Messages from DB Database-->>Resolver: Return Messages Resolver->>GmailClient: Fetch Additional Data from Gmail (if needed) GmailClient->>GmailAPI: API Request (e.g., Fetch Labels) GmailAPI-->>GmailClient: API Response GmailClient-->>Resolver: Return Gmail Data Resolver->>Cache: Store Messages in Cache end Resolver-->>GraphQL: Return Messages to Frontend Frontend->>GraphQL: Send ToggleStarred Mutation (messageId) GraphQL->>Resolver: Resolve ToggleStarred Resolver->>Database: Update Starred Status in DB Database-->>Resolver: Confirm Update Resolver->>GmailClient: Modify Message Labels in Gmail GmailClient->>GmailAPI: API Request (Modify Labels) GmailAPI-->>GmailClient: API Response GmailClient-->>Resolver: Confirm Label Modification Resolver->>Cache: Invalidate/Update Cached Messages Resolver-->>GraphQL: Return Updated Message to Frontend