Skip to content

WIP: Allow a user to be added to a team

Alf Eaton requested to merge belongs-to-team into master

This started out with adding a belongsToTeam(teamId) method to User, for use in Authsome modes - that was simple enough.

The test for the new method needs to be able to add a user to a team, but it's currently only possible to add a user to a team when the team is created; from then on team members can only be removed. I've tried to address that by allowing members to be added to a team at any time.

There's still a bug in here which is difficult to track down, as I've essentially had to add all the code that an ORM would need to keep both sides of a ManyToMany relationship up-to-date (each Team has a members list of User ids, and each User has a teams list of Team ids, and they both need to be kept in sync (ideally inside a transaction, but I haven't attempted that here)).

Merge request reports