Best way to allow multiple users to join as a 'team' assigned to the same company

Hi,

As above. We are building a portal - where we want to allow the companies who join, to invite multiple team members. I’m wondering the best way to structure this in the DB?

Just like you describe it.

A Company is a Thing. A Team is a Thing. A Team has a field of type Company on it. In this way, Companies have an inferred List of Teams.

(No point in building that list explicitly unless you are expecting every Company in the world to sign up for your app (aside: this will not happen). Even then, a Company’s Teams can be inferred.)

A User is already a Thing. It is the default Thing. The User is primary.

A User might belong to any Team (and any number of Teams, if you think about it), so Users have a field called “Teams” which is a list of type Team on them.

Why should we build a list of Teams on the User? Because that’s where the rubber meets the road. Teams do not use your app Companies do not use your app. USERS use your app. You will surely find yourself referencing Some_User’s Teams on a regular basis, so make that.

Done.

Make an app. (Also: You don’t have to plan this in advance in Bubble, you can just improvise/make changes as you need them. But good on ya for thinking ahead.)

3 Likes

Thank you Keith, this helps me think through organization.

To simplify things, could I have on the ‘User’ a ‘Company’ field, with the users company name or Company thing unique ID as well as a Team as a list type. This way, we can have ‘users’ assigned to a company, and within that company they can be assigned to single departments (teams, e.g. Sales, Marketing). Would this simplify things, or you still feel we should have Company thing that has field type of Team list type?

My concern having so many columns for a user (I already have quite a few) is speed, so want to ensure optimum speed, by correct organisation etc.

1 Like

Thanks for the explanation here Keith, very helpful. What’s the best DB setup for then searching for all team member’s entries in a separate type thing? ie - listing out each team member’s entries for today.

It seems like I need a field in type team called “Members” which is a list of type user. But then again, it seems like type thing and type team should have a common link by type user?

What am I missing here?