I am building new app and trying to improve my coding practices. As I found it applicable in my app, I am using big parts of Equinox Project (https://github.com/EduardoPires/EquinoxProject), so I implemented(*ing) DDD and CQRS.
I am struggling with the transactions arrangement. The app is sort of multitenant app where there is multiple users and multiple groups. User can belong to one group only. When user is registered, he has to either create new group or ask owner to join one. When I am creating the group, I have to do that in transaction:
- Create group.
- Assign user to group.
- If for some reason user wouldn't be assigned to group, I have to roll it back.
How should it be solved to not mess up the code and don't introduce any code smells?
Aucun commentaire:
Enregistrer un commentaire