1package operations
2
3import (
4 "github.com/MichaelMure/git-bug/bug"
5)
6
7// CreateOperation define the initial creation of a bug
8
9var _ bug.Operation = CreateOperation{}
10
11type CreateOperation struct {
12 bug.OpBase
13 Title string
14 Message string
15}
16
17func NewCreateOp(author bug.Person, title, message string) CreateOperation {
18 return CreateOperation{
19 OpBase: bug.NewOpBase(bug.CreateOp, author),
20 Title: title,
21 Message: message,
22 }
23}
24
25func (op CreateOperation) Apply(snapshot bug.Snapshot) bug.Snapshot {
26 snapshot.Title = op.Title
27 snapshot.Comments = []bug.Comment{
28 {
29 Message: op.Message,
30 Author: op.Author,
31 UnixTime: op.UnixTime,
32 },
33 }
34 return snapshot
35}