I’m designing an axon application that involves the creation of a process definition.
Each process can have some sub processes, each sub process can have himself other subprocess and/or tasks, and for each level of the process we can assign work to do and permissions.
My model is composed of a ProcessDefinition aggregate with some aggregate members for sub processes/tasks and work/permission.
For the query side I have a table defining all the process activities (process, sub processes, tasks) including a link towards the parent activity to be able to reconstruct the tree of activities.
We use some kind of inheritance for all data defined. For instance it’s possible to set a default “task outcome” at the level of the process that will define the default outcome for all the tasks unless a more specific task outcome is defined at the level of the sub process or the task.
My question is, how should this case be handled DDD wise? For instance when a command SetTaskOutcome is sent at the level of the process, should I only apply a TaskOutcomeSet event for the process and deal with the inheritance logic in my read model or should I do all this business logic in my aggregate sending a TaskOutcomeSet event for each task of the hierarchy?
This aspect is not so clear to me.
I hope my question is clear at least
Thanks a lot,