I am designing a guest check-in system for a residency hall. Residents can check-in guests, but only if these two constraints are met. 1. A resident can only have 2 guests checked-in at once 2. A guest can only be checked in with one resident
The check-in process results in a Visit.
I'm having trouble figuring out where these rules should be implemented. I started with this
var visit = resident.checkin(guest);
But that means I am modifying (or creating) three aggregates in one action:
- Resident (increment # of checked in guests)
- Guest (set them as checked in)
- Visit = created
I don't see a concept in the domain to model as aggregate to hold these rules. Residents and guests exist outside of visits (or across other visits), so can't be wrapped in another aggregate.
I thought about a Saga, but that ends up in steps that don't make sense in the domain (like checking in the student and guest separately to see if one fails).
I could use some guidance? Is my modelling just off?