-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeddysExample.json
More file actions
116 lines (116 loc) · 3.75 KB
/
Copy pathTeddysExample.json
File metadata and controls
116 lines (116 loc) · 3.75 KB
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
{
"useCase": "CreateProduct",
"behavior": "Create a new product",
"input": [
{ "name": "productId", "type": "String", "note": "Product 的唯一識別碼" },
{ "name": "name", "type": "String", "note": "Product 的顯示名稱" },
{ "name": "userId", "type": "String", "note": "建立 Product 的使用者 ID, 紀錄在領域事件中" }
],
"aggregate": "Product",
"aggregateId": "ProductId",
"method": "Product constructor",
"domainEvent": "ProductEvents.ProductCreated",
"repository": "ProductRepository",
"output": "CqrsOutput with productId",
"domainModelNotes": [
"Product 是 Aggregate Root",
"Product 使用建構函數建立新實例"
],
"constructorPreconditions": [
{
"rule": "Required fields validation",
"description": "Product id 和 name 都必須通過 requireNotNull() 檢查",
"fields": ["id", "name"]
}
],
"constructorPostconditions": [
{
"rule": "Field assignment verification",
"description": "使用 ensure() 檢查所有欄位都正確設定",
"checks": [
"Product id is set correctly",
"Product name is set correctly",
"Product state is DRAFT initially"
]
},
{
"rule": "Domain event verification",
"description": "確保 ProductCreated 領域事件正確產生",
"validation": "最後一個領域事件必須是 ProductCreated 且包含正確的 id, name, state"
}
],
"aggregates": [
{
"name": "Product",
"description": "產品",
"attributes": [
{ "name": "id", "type": "ProductId", "constraint": "non-null" },
{ "name": "product", "type": "ProductName","constraint": "non-null" },
{ "name": "goal", "type": "ProductGoal", "constraint": "default = null" },
{ "name": "note", "type": "String", "constraint": "default = null" },
{ "name": "extension", "type": "String", "constraint": "default = null" },
{ "name": "state", "type": "ProductLifecycleState", "constraint": "default = DRAFT"}
]
}
],
"domainEvents": [
{
"name": "ProductEvents.ProductCreated",
"description": "產品建立",
"attributes": [
{ "name": "productId", "type": "ProductId" },
{ "name": "name", "type": "ProductName" },
{ "name": "goal", "type": "ProductGoal" },
{ "name": "note", "type": "String" },
{ "name": "extension", "type": "String" },
{ "name": "state", "type": "ProductLifecycleState"}
]
}
],
"entities": [
{
"name": "ProductGoal",
"description": "產品目標",
"attributes": [
{ "name": "id", "type": "ProductGoalId" },
{ "name": "title", "type": "String" },
{ "name": "description", "type": "String" },
{ "name": "metrics", "type": "final List<GoalMetric>" },
{ "name": "definedAt", "type": "final Instant" },
{ "name": "revisedAt", "type": "Instant" },
{ "name": "state", "type": "ProductGoalState" }
]
}
],
"valueObjects": [
{
"name": "GoalMetric",
"description": "Product Gaol 指標",
"fields": [
{ "name": "name", "type": "String" },
{ "name": "unit", "type": "String" },
{ "name": "targetValue", "type": "BigDecimal" },
{ "name": "currentValue", "type": "BigDecimal" },
{ "name": "isKey", "type": "boolean" }
]
}
],
"enums": [
{
"name": "ProductLifecycleState",
"description": "產品生命週期狀態",
"values": ["DRAFT","ACTIVE","SUSPENDED","DEPRECATED","EOL","ARCHIVED"]
},
{
"name": "ProductGoalState",
"description": "產品目標狀態",
"values": [
"PLANNED",
"ACTIVE",
"ACHIEVED",
"SUPERSEDED",
"CANCELLED"
]
}
]
}