Designing Command with complex strcutures

Hi All,

This is more of a CQRS questions but I would like to hear the answer in regards to Axon.

I have an aggregate called Organisation with a bunch of Offices as value objects. You can have two scenarios in the system:

  1. Add an Organisation with a Single Office in
  2. Add an office to an existing Organisation

In case 1, we want to create Organisation implicitly so the UI only captures Office details. We have a REST api that takes a CreateOrganisationRequest object in and creates Commands from that. What is the best way to

  1. Create an Organisation in the background and then Create the office. i.e Shall I break it down to 2 command CreateOrganisationCommand & AddOfficeCommand? This way I can reuse AddOfficeCommand for scenario 2.
  2. Have 2 different commands for the 2 scenarios.

Thanks

hi,

is it possible to create an organization without an office? If it isn’t I would have a single command to create an organization with its first office, and another command to create the office. Otherwise, have one command to create the organization, and another to add an office.

Cheers,

Allard