I have registration form where user can input username and password and also create company at the same time(or chose one of existing companies). User have multiple companies and company have multiple users. How can I correctly choose User or Company to be my aggregate root(or both of them?).
I set Company as an aggregate root, it is ok in registration process I'm creating company and adding user to the company (company.addUsers(...)). But when I want to update user profile info(such as name, surname), I cannot do it in company aggregate root. I can create UserAggreageRoot and update user there but in this case it would affect to registration process(because in one transaction UserAggregate and CompanyAggregate would be updated, which is wrong).