I'm working on a HR application that has employee management and access control.
We decided to go with these bounded contexts:
- Employee management: manage employees information, like name, contract, birthdate etc
- Access control: manage whether an employee can get into the facility, in which case we upload his or her fingerprint to fingerprint scanners. (fingerprint should be uploaded beforehand)
- Presence and absence: calendar (hours of work of each employee), based on information from timecloks, we get to calculate presence, absence, how many times employee got into the facility etc.
the boundaries between these bounded contexts are clear and easily seen by the specific language of each of these contexts.
The problem at hand is, we have a UI page that holds employee information, this same page contains both information related to employee management and also information related to access control (example: identifier of this employee in the fingerprint scanners which is an integer).
When the user edits all this data, he saves it at once with save button, this is supposed to be single transaction (the save), but it involves two savings of two aggregates in two bounded contexts.
Currently, aggregates across all these bounded contexts are saved in one database but we like to keep the possibility of making them in separate schemas in the future.
How to handle this situation to insure that if saving in one database wasn't done properly for some reason, than the saving in the other database is not going to be saved as well.
Also I thought about changing the way we do our UI, but this situation is almost frequent where one UI can hold information of multiple contexts, and saving info on that page will include updates on those contexts as well at once.
Any suggestions will be much appreciated.