How to structure GraphQL server code
Jonas Helfer

Hi there, so I’m building my project similar to the GitHunt API. What I realized it is a bit different from what you described from this article In GitHunt API, each model only has one connector.

Repositories => GitHub
Users => GitHub
Comments => SQL
Entries => SQL

Then they’re passed via context: 
Repositories: new Repositories({ connector: gitHubConnector })
Users: new Users({ connector: gitHubConnector })
Entries: new Entries()
Comments: new Comments()

My question is, if we were keeping the good structure in the GitHunt API, what do you do when one Model deals with multiple Connectors? My specific use case is I have a collection of Books which belong to my MongoDB, but on writes, I need them to sync to ElasticSearch.

So would this look like:
Books: new Books({ connector: mongoDbConnector, sync: elasticSearchConnector })
Books: new Books({ connector: mongoDbConnector })
IndexedBooks: new IndexedBooks({ connector: elasticSearchConnector })

What would you do?