Reputation: 1535
I have three aggregates, a Task, a User, and a User Group. The aggregates are event-sourced. I also have two projections, a collection of Tasks and a collection of User Groups. These are built from the events. My users want to filter the Tasks based on the User Groups they are in. What approach should I take?
Upvotes: 0
Views: 415
Reputation: 942
At some point, there will be the event of assigning a certain task (or a list of tasks) to a certain user group. The projection of that event then writes some information about that relationship into your read store. Depending on your use case and database technology, this could be a simple property added to each projected task / task list, or you could build pre-filtered lists for each user group.
In Event Sourcing, the event stream represents the source of truth. Thus, the projected data can be tailored much more towards certain representation needs than it is the case with traditional, relational data.
Upvotes: 3