From 6a12373965aff9f80147f8b5bff6a5a104927365 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 25 Jul 2018 18:01:32 +0200 Subject: more refactoring to have reusable bug action across different UI --- bug/operations/create.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bug/operations/create.go') diff --git a/bug/operations/create.go b/bug/operations/create.go index 72eba843..0fd1225e 100644 --- a/bug/operations/create.go +++ b/bug/operations/create.go @@ -33,3 +33,11 @@ func (op CreateOperation) Apply(snapshot bug.Snapshot) bug.Snapshot { } return snapshot } + +func Create(author bug.Person, title, message string) (*bug.Bug, error) { + newBug := bug.NewBug() + createOp := NewCreateOp(author, title, message) + newBug.Append(createOp) + + return newBug, nil +} -- cgit