-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-sample.riddl
More file actions
118 lines (97 loc) · 2.4 KB
/
test-sample.riddl
File metadata and controls
118 lines (97 loc) · 2.4 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
117
118
// Test RIDDL file for syntax highlighting
// This file demonstrates various RIDDL language features
author Reid is {
name: "Reid Spencer"
email: "reid@ossum.biz"
}
// A domain definition
domain ECommerce is {
// Type definitions
type OrderId is Id(Order)
type ProductId is Id(Product)
type CustomerId is Id(Customer)
type Money is Decimal(10,2)
type EmailAddress is String(5,1020)
// Command definitions
command PlaceOrder(
orderId: OrderId,
customerId: CustomerId,
items: ProductId+
)
// Event definitions
event OrderPlaced is {
orderId: OrderId,
timestamp: TimeStamp
}
// Record type
record OrderItem is {
productId: ProductId,
quantity: Integer,
price: Money
}
// Context definition
context Ordering is {
// Entity definition
entity Order is {
// State definition
state OrderState is {
orderId: OrderId,
customerId: CustomerId,
status: String,
items: OrderItem*,
total: Money
}
// Handler definition
handler PlaceOrderHandler is {
on command PlaceOrder {
// Handler logic would go here
send event OrderPlaced to OrderHistory
}
} with {
briefly "Handles order placement"
}
// Function definition
function calculateTotal is {
requires { items: OrderItem* }
returns { total: Money }
}
} with {
briefly "Represents a customer order"
}
} with {
briefly "Handles order processing"
}
// Epic definition
epic CustomerOrdering is {
user Customer wants "to place an order" so that "they can purchase products"
case primary is {
user Customer wants "to select products" so that "they can add to cart"
}
case secondary is {
user Customer wants "to review order" so that "they can confirm purchase"
}
} with {
briefly by "Customer ordering workflow"
}
// Repository definition
repository OrderRepository is {
??? // Implementation TBD
}
} with {
by author Reid
briefly "E-commerce domain model"
described as {
|This domain models an e-commerce system
|with orders, products, and customers.
|
|## Features
|* Order placement
|* Product catalog
|* Customer management
}
}
/* Multi-line comment
demonstrating block comments
in RIDDL syntax */
// Include example
include "other-domain.riddl"