Repository navigation
Expand file tree
/
Copy pathlibrary.play
More file actions
52 lines (41 loc) · 1.6 KB
/
Copy pathlibrary.play
File metadata and controls
52 lines (41 loc) · 1.6 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
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// A deliberately small model-first sample: one command, one fact, and two model specifications.
domain Library
concept BookId : Uuid
concept BookTitle : String
concept AuthorName : String
module Library
description "A small catalog model used to demonstrate the model-first developer journey"
feature Catalog
description "Adding a book to the library catalog"
slice StateChange AddBook
description "Adds one identified book to the catalog"
command AddBook
bookId BookId identifier
title BookTitle
authorName AuthorName
validate
title not empty message "A title is required"
authorName not empty message "An author name is required"
produces BookAddedToCatalog
for bookId
title = title
authorName = authorName
event BookAddedToCatalog
title BookTitle
authorName AuthorName
specification AddingABook
when AddBook
bookId = "75926956-26c2-4e60-a239-10367a2afbd8"
title = "The Quiet Archive"
authorName = "Mara North"
then BookAddedToCatalog
title = "The Quiet Archive"
authorName = "Mara North"
specification RejectingABookWithoutATitle
when AddBook
bookId = "69064f39-6a76-458a-8a34-088eb4752650"
title = ""
authorName = "Mara North"
then error "A title is required"