-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventStormingShoppingElephant.puml
159 lines (125 loc) · 9.28 KB
/
EventStormingShoppingElephant.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
@startuml
!startsub DECL
!includeurl https://raw.githubusercontent.com/dreamsinbits/event-storming-puml/refs/heads/main/src/EventStorming.iuml
!$user = 'User'
!$recurringItemsList = 'Recurring items list'
!$recipe = 'Recipe'
!$shoppingList = 'Shopping list'
!$mealPlan = 'Meal plan'
!$shopper = 'Shopper'
!$shopping = 'Shopping'
!$loginView = 'Username, password'
!$registerView = 'First name, last name, e-mail, username, password'
!endsub
!startsub UserManagement
SubDomain('User Management', UserManagement) {
Process('Logging in', LoggingIn) {
DomainEvent('Logged out', LoggedOut, $Aggregate($user), $Command(LogOutUser), $User($shopper), $ReadModel($loginView))
DomainEvent('Logged in', LoggedIn, $Aggregate($user), $Command(LogInUser), $User($shopper), $ReadModel($loginView))
}
Process('User deletion', UserDeletion) {
DomainEvent('Deleted user', DeleteUser, $Aggregate($user), $Command(DeleteUser), $User($shopper))
User('Admin', Admin)
Admin - DeleteUser_Command
Admin -[hidden] DeleteUser_User
}
Process('User Registration', UserRegistration) {
DomainEvent('Registered user', RegisteredUser, $Aggregate($user), $Command(RegisterUser), $User($shopper), $ReadModel($registerView))
}
UserRegistration -[hidden]--- UserDeletion
UserRegistration -[hidden] LoggingIn
}
!endsub
!startsub RecipeManagement
SubDomain('Recipe Management', RecipeManagement) {
Process('Adding of recipes') {
DomainEvent('Added recipe', AddedRecipe, $Aggregate($recipe), $Command(AddRecipe), $User($shopper), $System('External recipe system'))
}
}
!endsub
!startsub MealPlanning
SubDomain('Meal Planning', MealPlanning) {
Process('Favorite meal plan', FavoriteMealPlan) {
DomainEvent('Made meal plan a favorite', MadeMealPlanAFavorite, $Aggregate($mealPlan), $Command(FavoriteMealPlan), $User($shopper))
}
Process('Meal plan editing', MealPlanEditing) {
DomainEvent('Removed meal from meal plan', RemovedMealFromMealPlan, $Aggregate($mealPlan), $Command(RemoveMealFromMealPlan), $User($shopper), $ReadModel('Added meals'))
DomainEvent('Added meal to meal plan', AddedMealToMealPlan, $Aggregate($mealPlan), $Command(AddMealToMealPlan), $User($shopper), $ReadModel('Available meals'))
DomainEvent('Created new meal plan', CreatedNewMealPlan, $Aggregate($mealPlan), $Command(CreateEmptyMealPlan), $User($shopper), $ReadModel('Meal plan name'))
}
MealPlanEditing -[hidden] FavoriteMealPlan
}
!endsub
!startsub ShoppingPlanning
SubDomain('Shopping Planning', ShoppingPlanning) {
Process('Sharing of shopping lists') {
DomainEvent('Shared shopping list with user', SharedShoppingListWithUser, $Aggregate($shoppingList), $Command(ShareShoppingListWithUser), $User($shopper), $ReadModel('Available users'))
}
Process('Shopping list template creation') {
DomainEvent('Created shopping list template', CreatedShoppingListTemplate, $Aggregate($shoppingList), $Command(CreateShoppingListTemplate), $User($shopper))
note "Is created from a shopping list." as TemplateNote
CreatedShoppingListTemplate_Aggregate .. TemplateNote
}
Process('Voucher handling') {
DomainEvent('Removed voucher', RemovedVoucher, $Aggregate($shoppingList), $Command(RemoveVoucherFromShoppingList), $User($shopper), $ReadModel('Available vouchers'))
DomainEvent('Added voucher', AddedVoucher, $Aggregate($shoppingList), $Command(AddVoucherToShoppingList), $User($shopper), $ReadModel('Voucher image or hyperlink'))
note "This must also be possible while shopping, perhaps the user finds some vouchers in the shop." as AddVoucherNote
AddedVoucher .. AddVoucherNote
}
Process('Editing shopping list') {
DomainEvent('Created new shopping list', CreatedNewShoppingList, $Aggregate($shoppingList), $Command(CreateShoppingList), $User($shopper), $ReadModel('Available templates, Old shopping lists'))
note "Can be created from a template, an old shopping list or from scratch.\nIt's possible that there are multiple lists" as ShoppingListCreationNote
ShoppingListCreationNote . CreatedNewShoppingList_Aggregate
DomainEvent('Added meal plan', AddedMealPlan, $Aggregate($mealPlan), $Command(AddMealPlanToShoppingList), $User($shopper), $ReadModel('Available meal plans'))
DomainEvent('Added unchecked products from last shopping', AddedUncheckedProductsFromLastShopping, $Command(AddUncheckedProductsFromLastShopping), $Aggregate($shoppingList), $Policy('Whenever the last shopping still contains unchecked products in the shopping list'), $ReadModel('Last shopping'))
DomainEvent('Added ingredients of meal', AddedIngredientsOfMealRecipe, $Command(AddMealIngredients), $Aggregate($shoppingList), $ReadModel('Meal ingredients'), $Policy('Whenever a meal plan was added'))
DomainEvent('Removed ingredients of removed meal from shopping list', RemovedIngredientsOfRemovedMealRecipe, $Command(RemoveMealIngredients), $Aggregate($shoppingList), $ReadModel('Meal plan'), $Policy('Whenever a meal was removed from the meal plan'))
DomainEvent('Flagged checked ingredients of removed meal recipe', FlaggedCheckedIngredientsOfRemovedMealRecipe, $Command(MarkCheckedIngredientsOfRemovedMealRecipe), $Aggregate($shoppingList), $ReadModel('Removed meal'), $Policy('Whenever a meal was removed from the meal plan but ingredients where already checked'))
DomainEvent('Added product', AddedProduct, $Aggregate($shoppingList), $Command(AddProductToShoppingList), $User($shopper), $ReadModel('Product name, List of already used products'))
DomainEvent('Removed product', RemovedProduct, $Aggregate($shoppingList), $Command(RemoveProductFromShoppingList), $User($shopper), $ReadModel('Added products'))
CreatedNewShoppingList - AddedUncheckedProductsFromLastShopping_Input
AddedUncheckedProductsFromLastShopping -[hidden] AddedMealPlan_Input
AddedMealPlan - AddedIngredientsOfMealRecipe_Input
AddedIngredientsOfMealRecipe -[hidden] RemovedIngredientsOfRemovedMealRecipe_Input
RemovedIngredientsOfRemovedMealRecipe -[hidden] FlaggedCheckedIngredientsOfRemovedMealRecipe_Input
FlaggedCheckedIngredientsOfRemovedMealRecipe -[hidden] AddedProduct_Input
AddedProduct -[hidden] RemovedProduct_Input
}
}
!endsub
!startsub Shopping
SubDomain('Shopping', Shopping) {
Process('Checkout', CheckoutProcess){
DomainEvent('Started checkout', StartedCheckout, $Aggregate($shopping), $Command(StartCheckout), $User($shopper))
DomainEvent('Presented vouchers', PresentedVouchers, $Aggregate($shoppingList), $Command(PresentVouchers), $Policy('Whenever the shopping list contains vouchers'))
DomainEvent('Redeemed voucher', RedeemedVoucher, $Aggregate(Voucher), $Command(RedeemVoucher), $User($shopper))
DomainEvent('Redeemed all vouchers', RedeemedVouchers, $Aggregate($shoppingList))
DomainEvent('Payed', Payed, $Aggregate($shopping), $Command(Pay), $User($shopper), $ReadModel('Optional: Sum'))
DomainEvent('Received receipt', ReceivedReceipt, $Aggregate($shopping), $Command(ReceiveReceipt), $User($shopper), $ReadModel('Image of receipt'))
DomainEvent('Ended shopping', EndedShopping, $Aggregate($shopping), $Command(EndShopping), $User($shopper))
StartedCheckout - PresentedVouchers_Input
PresentedVouchers -[hidden] RedeemedVoucher_Input
RedeemedVoucher - RedeemedVouchers_Input
RedeemedVouchers -[hidden] Payed_Input
Payed -[hidden] ReceivedReceipt_Input
ReceivedReceipt -[hidden] EndedShopping_Input
}
Process('Shopping', ShoppingProcess) {
DomainEvent('Started shopping with shopping list', StartedShoppingWithShoppingList, $Aggregate($shopping), $Command(StartShopping), $User($shopper), $ReadModel('Available shopping lists'))
DomainEvent('Put product in shopping cart', PutProductInShoppingCartEvent, $Aggregate('Shopping cart'), $Command(PutProductInShoppingCart), $User($shopper), $ReadModel('Shopping list, Product'))
note "This aggregate enables to show the user what is in the shopping cart." as ShoppingCartNote
ShoppingCartNote . PutProductInShoppingCartEvent_Aggregate
DomainEvent('Checked product in shopping list', CheckedItemInShoppingList, $Aggregate($shoppingList), $Command(CheckProduct), $ReadModel('Product'), $Policy('Whenever a product was put in the cart'))
DomainEvent('Checked all products in shopping list', CheckedAllItemsInShoppingList, $Aggregate($shoppingList))
DomainEvent('Returned product to shelf', ReturnedProductToShelf, $Aggregate('Shopping cart'), $Command(ReturnProductToShelf), $User($shopper), $ReadModel('Product'))
DomainEvent('Unchecked item in shopping list', UncheckedItemInShoppingList, $Aggregate($shoppingList), $Command(UncheckItem), $ReadModel('Product'), $Policy('Whenever a product was returned'))
StartedShoppingWithShoppingList -[hidden] PutProductInShoppingCartEvent_Input
PutProductInShoppingCartEvent - CheckedItemInShoppingList_Input
CheckedItemInShoppingList - CheckedAllItemsInShoppingList_Input
CheckedAllItemsInShoppingList -[hidden] ReturnedProductToShelf_Input
ReturnedProductToShelf - UncheckedItemInShoppingList_Input
}
ShoppingProcess -[hidden]--- CheckoutProcess
}
!endsub
@enduml