I have a database with three primary tables: users
, teams
, and folders
joined by two junction tables, users_teams
and t
Pay attention to following:
User.belongsToMany(Team, {
through: 'users_teams',
foreignKey: 'user_id',
otherKey: 'team_id'
});
Team.belongsToMany(User, {
through: 'users_teams',
foreignKey: 'team_id',
otherKey: 'user_id'
});