Microservices with Clojure
上QQ阅读APP看书,第一时间看更新

Domain model

Based on the user stories, Service Order and Service (catalog) are the two core domains of the Helping Hands application. Apart from these two domains, user accounts, provider accounts, and notifications are the generic domains that form the Helping Hands application. Service ConsumerService ProviderService, and Service Order are entities of the Helping Hands application. These are shown along with their fields in the following diagram:

Each Service Consumer has an ID assigned in the system and has Name, Address, Mobile, and Email defined as some of the attributes. The Geo Location of each consumer is derived from the address information. Each Service Provider also has an ID assigned in the system with Name, Mobile, Active Since, and Overall Rating as some of the attributes. A Service is registered by the Service Provider and has a unique ID defined in the system. It is registered against a Service Type and has one or more Service Areas defined. Based on the Service Areas, the system derives the Geo Location Boundary where the service is offered to the consumers. A Service also has an Hourly Cost set by the Service Provider and keeps an Overall Rating based on the previous orders.

Service Consumer subscribes to the Service and places a Service Order for the Service Provider to fulfill. Each Service Order has an ID defined in the system and has an associated Service ID, Provider ID, and Consumer ID. Each order entry has an associated Time Slot based on which the Cost is determined by the system. The Service Order also has a status that is updated by the Service Provider once the order is completed. The order also keeps a Rating between 1 and 5, as rated by the consumer for the service provided.

The Helping Hands application also alerts the Service Consumer and the Service Provider with respect to the related Service Order. Any change in Status is notified to both the participants via SMS sent over the registered mobile number. The Service Consumer can also subscribe to Service and receive all updates with respect to service status, availability, cost changes, and so on.