jeudi 16 novembre 2017

Modeling relationships with domain models

In my system, an User can be member of a Team.

I got a domain model called Team which contains id, name, member_count and is_channel. So when I fetch teams in the repository I retrieve the Team domain model.

How would I model the relation between a User and a Team? Because when talking about the relation I don’t care about the member_count and is_channel from the Team model. I even have extra data in the relation which is a role_type.

Should I create a domain model for the relation called TeamScope or something? That contains id, user_id, team_id, role_type?

Aucun commentaire:

Enregistrer un commentaire