--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If I want to have a rule that says look at the customer's old orders to give him a discount if a products were ordered before, how do I do that? Should I be running this kind of rule through the readmodels (feels dirty). Should I have some other list on the Customer that has a subset of the data from the orders that I need for the validation?
Have a CustomerDiscount aggregate identified by customerid. When ProductOrdered happens get the customerid from it and load CustomerDiscount. Pass the productid from the event to a method on the CustomerDiscount that will check if it has been passed before and if so output CustomerDiscountApplied
--
As an example if I have a Customer and Order aggregate, the way this is modelled is that there is no Customer.Orders. Rather Order has a customer Id.If I want to have a rule that says look at the customer's old orders to give him a discount if a products were ordered before, how do I do that? Should I be running this kind of rule through the readmodels (feels dirty). Should I have some other list on the Customer that has a subset of the data from the orders that I need for the validation?