Our business works with truck drivers making pickups/deliveries of containers. The location of containers needs to be tracked.
The drivers use mobile devices to generate a "DriverReport" (a log of their trip locations, times, container pickup/drop-offs, etc.). This is currently working with a mostly CRUD design.
We wanted to maintain good SoC so we built two services:
We've had the DriverService take a dependency on the InventoryService. When a new DriverReport was inserted, it would generate DTO's (based off the reports data) that could be sent to the InventoryService.
We're not using CQRS yet, but we're considering transitioning to it.
I'm struggling to understand the relationship between the services, commands and BLL. I seem to have lots of questions.
Who would be responsible for calling the inventory service?
Would it be good design for a NewTripCommandHandler to generate and send an UpdateContainerInventory command?
Or, would updating inventory for a new Trip be considered business logic? If yes, should a a domain entity for Trip generate and send an UpdateContainer command?
Or, should the mobile client generate both trip and inventory specific commands to send to the appropriate service?
Would it make more sense to take the parts specific to DriverReport inventory and merge it into the DriverService (so the dependency is broken)? Is that still good SoC? If we did this, at what layer might we start to think about the inventory? Would updating the inventory simply become a DB repository concern, or should there still be inventory specific commands and/or business logic?
I'm getting lost in the details, and it seems the more I read on the topics, the more confused I get.