Hi Payload server :)
I am building out a internal esport-portal website where users can sign in and register to participate in esport tournaments. I have collections for players, teams, games, and I'm running into some complex relationship-linking, and I'm a bit stuck on how to proceed with some of the structure I am envisioning.
I want visitors to either register a team, apply to an alearcy existing team, or sign up as solo players and try to get placed on a team by an admin.
I have a form where a user can input a team name, and select the appropriate game, and register it. This creates a team in the admin dashboard, and assigns the registering user as the team captain and assigns the user as a player to the team.
The Player collection has a relationship to the 'teams' collection, with 'hasMany'. The 'teams' collection has a 'join' field to the 'teams'-field on the Player-collection.
What I want is to have player-roles specific to the team - aka a team can have players with roles ['captain', 'player', 'substitute']. If I create these roles on the Player collection, the roles are stored on the Player document and is global across all teams, no? I would like for one player to be a Captain on one Team while also being a Substitute on another. Is there a clean way to do this in Payload that I'm not thinking of?
I would also like for a flow where when players apply to a team, to put them in a 'waiting-for-approval' state on the team, and allow the team-captain (or a site admin) to approve or deny the users into the team. This could be solved if I solve the player-role-per-team issue decribed above.
Can post collection configs if needed :)