I’d like to as for some guideline or hint how to model the following problem with DDD.
I need to calculate loyalty points based on some defined Policy and Order placed. I have following model:
aggregate Policy {
Id;
Name;
Strategy; // Entity
}
entity Strategy {
Id;
PointsPerOneUsdSpent;
OtherImportantProps;
}
… and now I want to keep track of all issued/calculated points:
aggregate ProcessedOrder {
OrderId;
PointsGiven;
StrategyUsed; // this is problematic
}
if I keep StrategyUsed [frp[erty as a reference to Strategy entity object, I will reference same entity from 2 difference aggregates, which is wrong. How to tackle this problem? Should Policy/Strategy and ProcessedOrder belong to 2 different bounded contexts? Or maybe the Strategy should be a value object? Or is there simpler way?
submitted by /u/bzq84
[link] [comments]