Hi Folks,
I’m currently working on a big multi-tenant app. We started developping it with the meteor’s cassical way (methods and pub/sub), but we quickly found that such a big app would need a much more relational data-management system, so we decided to rework some modules with Apollo / GraphQL.
A user can be a member of several teams, but he can work on a single team at a time in a single tab, as the current team’s id is stored in redux. And as sending the current team’s id on every method call would be a huge pain, we simply save the current team the user’s working on in the server’s connection object
Meteor.methods({
setWorkingTeamForThisConnection( teamId ){
this.connection.currentTeam = teamId;
},
addUserToTheCurrentTeam( userId ){
addUserToTeam( userId, this.connection.currentTeam );
}
});
And it works great ! It even allow the user to have multiple tabs opened on different teams without any problem ! But now that we are switching to Apollo, I’d like to get this info in my resolvers, but I can’t find a way to get access to the user’s current connection object.
How could I do so ?
If I can’t, what would be an elegant work-around for this usecase ? I’d like not to have to send the current team id in each resolver…
Thanks you, and sorry for my poor english !