Open
Description
Hello,
I'm currently evaluating Feathers for our team and love it. I'm trying to cover all of our use cases and am stumped on how to handle creating or updating associations between entities with many to many relationships.
I'd like to request for a save and update m to n relationship feathers example.
Scenario:
There are two services /players and /teams (these are arbitrary resources I thought of). Players may belong to many teams and Teams have many players. I'm not sure how to handle associating players with teams in an elegant fashion.
I'd like to understand how to do the following:
- Add a player to a team
- Remove a player from a team
I am able to setup the association fine:
team.model.js
...
team.associate = function (models) {
team.belongsToMany(models.player, {through: 'PlayerTeam'});
};
...
player.model.js
...
player.associate = function (models) {
player.belongsToMany(models.team, {through: 'PlayerTeam'});
};
...