My app will be a database of players
. That's the core data point of the database. Players (aka...the profiles of players) are what users will login to view/edit/update/delete.
Think of it like a recruiting database, where I (as a recruiter) can login to see the types of players I want to recruit to my team.
So what I am struggling with is how to model the User relationships. Here are the business rules.
- Each player should be able to login to update their own profile.
- Each player does NOT have to have a User account, but they CAN if they want.
- Each player has attributes that a normal 'User' record doesn't have (e.g. an avatar, academic results, a video, etc.).
- Each coach can login to view all the profiles of the players.
- Each coach should be able to add other coaches/recruiters to their account.
- Each admin should be able to CRUD players
This is where it is tricky...a player
should just be another Model...because they are the central record for the entire app (like an image may be on an image-sharing site). Where it gets tricky is that each player can be
associated with a user record, but doesn't HAVE to be.
What would the associations look like? What would be just a role of the User
class and what would be an association with another model?