feat: implement GraphQL API with Apollo Server#286
Conversation
|
@YLaxmikanth is attempting to deploy a commit to the niharika-mente's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Review: GraphQL API implementation with Apollo Server. Very significant architectural addition. Verify: Apollo Server setup, schemas and resolvers for products/orders/users, query and mutation coverage, subscriptions for real-time updates, GraphQL playground access, coexistence with REST API, migration path. Document GraphQL endpoints. Hard difficulty appropriate. Status: Needs architecture review and testing. |
Aamod-Dev
left a comment
There was a problem hiding this comment.
Solid GraphQL integration with Apollo Server and express4 middleware. Well-defined schema covering Product/User/Order with CRUD mutations. Note: graphql v17 requires Node.js >=22 — ensure deployment uses compatible runtime. Safe to merge.
|
PR has merge conflicts preventing clean merge. Please rebase on main. |
Aamod-Dev
left a comment
There was a problem hiding this comment.
Request Changes
resolvers.jsis imported inserver.jsbut missing from the PR. Server will crash on startup.graphql@17.0.1requires Node >=22 and is incompatible with@apollo/server@5.5.1(requiresgraphql@^16.11.0). Downgrade to graphql v16.- No auth/authorization on the GraphQL endpoint.
|
Missing resolvers, incompatible deps |
|
Hi @Aamod-Dev, I've addressed the requested changes:
Could you please take another look when convenient? Thank you! |
Aamod-Dev
left a comment
There was a problem hiding this comment.
Looks good, approved!
Aamod-Dev
left a comment
There was a problem hiding this comment.
Needs changes: There are merge conflicts. Please resolve them.
There was a problem hiding this comment.
- Critical Security Flaw: The GraphQL mutations (createProduct, updateProduct, deleteProduct, createUser, deleteUser) have no authorization checks. Unauthenticated users can currently hit the /graphql endpoint and manipulate products and users.
- Missing Business Logic: Product mutations in GraphQL bypass the core business logic (Elasticsearch indexing and Redis cache invalidation), which will lead to the search index and cache falling out of sync.
- Hard Delete vs Soft Delete: The deleteProduct mutation uses a hard delete (findByIdAndDelete), breaking the existing soft delete pattern (isDeleted: true) used elsewhere in the application.
|
Hi @Aamod-Dev, I've addressed the latest review comments:
Could you please take another look when convenient? Thank you! |
|
Look for ci pipeline errors |
Aamod-Dev
left a comment
There was a problem hiding this comment.
All review feedback addressed: resolvers.js added, graphql downgraded to v16, mutations secured with auth, Elasticsearch + Redis integration included, soft delete pattern used. Minor note: coupon routes were removed in merge — will restore separately. Approving.
Description
Implemented a GraphQL API alongside the existing REST API using Apollo Server.
Features Added
/graphqlTechnical Changes
BACKEND/graphql/README.mdBenefits
Fixes #275