I am currently trying to apply DDD and Microservices, and I have been currently struggling with the following situation:
Imagining there were 3 domains: User, Customer and Service Order.
There are 2 types of users: Admin and Technician
The admin receive calls from the customers to do a service in their location, so the admin SCHEDULES a service for a technician to go to the customer’s location.
The Front-End of this is simple: select the SCHEDULED DATE AND TIME, the TECHNICIAN and the CUSTOMER.
From this example I can think of a solution:
- the Service Order domain should have replicated from the User domain the Technicians IDs and Names so in the Schedule Service Screen the admin can find all the possible candidates for the service and also for validating if the selected technician exists
- the Service Order domain should also have replicated a bit of the customers data, like the id, name, address, etc. everything so the admin can filter for the customer, and also for validating if the customer exists
This makes sense in my head. The advantage of this is:
- easy authorization handle: it will be easy to manage the authorization, allowing only admins to access the Service Order domain’s methods
The disadvantage:
- too much replication of code, since the Service Order domain will have to expose 2 methods that are already in the other domains, but different since in the users are filtered by the technician role and the customers are limited only for the usage of the Service Order domain
I am kind of getting the hang of it, but still need some help to get to the right direction! What are your thoughts on this?