I am making a genealogy application as I am trying to learn Event Sourcing and CQRS. I have three aggregates in my application: PersonAggregate, FactAggregate, FamilyAggregate. My request from the UI to the Server to add a spouse to a person is:
{
personId: "", // And Existing Person in the DB
personInput: {name: "Bob", birthDate: ""} // Input to create a new person in the DB
}
My Family Aggregate listens to the PersonAggregate for events of PersonCreated
to keep a record of all people that have been created.
Would it be a good architecture for the UI to call the PersonAggregate to create the person (with the data about it needing to create a partnership between the two people instead of calling the FamilyAggregate), then on the PersonCreated
event to put the data the FamilyAggregate will need to know to add the two people as spouses? Or is that a bad design because now the Event has command data in it?
When a person is created, the Person Aggregate also needs to send data to the FactAggregate to create a Fact about the person's birthdate.