Order domain
A class diagram. Orders, line items, products, customers, addresses, payments and discounts, with a label and cardinalities on every relation.






┌──────────────────┐
│ Customer │
├──────────────────┤
│ - name: string │
│ - email: string │
└──────────────────┘
places ◇ 1 ◆ 1
│ │
┌────────┘ └────────┐ ships to
│ * │ 0..*
┌──────────────────┐ ┌──────────────────┐
│ Order │ │ Address │
├──────────────────┤ ├──────────────────┤
│ - id: string │ │ - street: string │
│ - placedAt: Date │ │ - city: string │
├──────────────────┤ └──────────────────┘
│ + total(): Money │
└──────────────────┘
contains ◆ 1 ◆ 1 ◇ 1
│ │ │
┌───────────────────┘ │ └─────────────────────┐ applies
│ 1..* settled by │ 1 │ 0..*
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────────┐
│ LineItem │ │ Payment │ │ Discount │
├──────────────────┤ ├──────────────────┤ ├──────────────────────┤
│ - quantity: int │ │ - method: string │ │ - code: string │
│ + price: Money │ └──────────────────┘ │ - percentOff: number │
└──────────────────┘ └──────────────────────┘
│ *
│ references
│ 1
┌────────────────┐
│ Product │
├────────────────┤
│ - sku: string │
│ - name: string │
└────────────────┘
◇── aggregation
─── association
◆── composition
Spec
{ "type": "class", "theme": "default", "legend": true, "classes": [ { "id": "order", "label": "Order", "attributes": [ {"visibility": "-", "text": "id: string"}, {"visibility": "-", "text": "placedAt: Date"} ], "methods": [{"visibility": "+", "text": "total(): Money"}] }, { "id": "item", "label": "LineItem", "attributes": [ {"visibility": "-", "text": "quantity: int"}, {"visibility": "+", "text": "price: Money"} ] }, { "id": "product", "label": "Product", "attributes": [ {"visibility": "-", "text": "sku: string"}, {"visibility": "-", "text": "name: string"} ] }, { "id": "customer", "label": "Customer", "attributes": [ {"visibility": "-", "text": "name: string"}, {"visibility": "-", "text": "email: string"} ] }, { "id": "address", "label": "Address", "attributes": [ {"visibility": "-", "text": "street: string"}, {"visibility": "-", "text": "city: string"} ] }, { "id": "payment", "label": "Payment", "attributes": [{"visibility": "-", "text": "method: string"}] }, { "id": "discount", "label": "Discount", "attributes": [ {"visibility": "-", "text": "code: string"}, {"visibility": "-", "text": "percentOff: number"} ] } ], "relations": [ { "id": "contains", "from": "order", "to": "item", "kind": "composition", "from_card": "1", "to_card": "1..*", "label": "contains" }, { "id": "references", "from": "item", "to": "product", "kind": "association", "from_card": "*", "to_card": "1", "label": "references" }, { "id": "places", "from": "customer", "to": "order", "kind": "aggregation", "from_card": "1", "to_card": "*", "label": "places" }, { "id": "ships-to", "from": "customer", "to": "address", "kind": "composition", "from_card": "1", "to_card": "0..*", "label": "ships to" }, { "id": "settled-by", "from": "order", "to": "payment", "kind": "composition", "from_card": "1", "to_card": "1", "label": "settled by" }, { "id": "applies", "from": "order", "to": "discount", "kind": "aggregation", "from_card": "1", "to_card": "0..*", "label": "applies" } ]}Draw it yourself
diago render order-domain.json > order-domain.svgOpen it in the playground to edit it in your browser.