Hi,
I've been reading through the documentation and am fairly confused on what the suggested relation should be for my use case (which I consider to be somewhat standard).
I have two user models - `users` and `teams`
These are the requirements:
- A user can have (be the owner) of multiple teams
- A team can have multiple members (users)
So far, I've set it up so that teams have a belongsTo relation with users as such:
"owner": {
"type": "belongsTo",
"model": "user",
"foreignKey": "",
"options": {
"nestRemoting": false
}
}
This seems to work as expected; a user can create a team, etc.
For the members relationship however, I can't figure out what the right relation would be. If I do a `hasMany` relation for example, I can't add existing users to the team... Would a `hasAndBelongsToMany` relation make sense? That however seems to require a join model that I'd need to apply or create somehow. When I implement the following, it throws an error saying the database does not exist if I try to add a user as a member:
"members": {
"type": "hasAndBelongsToMany",
"model": "user",
"foreignKey": "",
"options": {
"nestRemoting": false
}
}
Any help would be much appreciated!