-
Notifications
You must be signed in to change notification settings - Fork 0
/
backlog_item.go
70 lines (54 loc) · 1.2 KB
/
backlog_item.go
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
package backlogitem
import (
"context"
subtask "github.com/abekoh/go-saas-ovation/domain/sub_task"
"github.com/google/uuid"
)
type ID uuid.UUID
func (i ID) String() string {
return uuid.UUID(i).String()
}
type Type string
const (
Story Type = "STORY"
Bug = "BUG"
)
type StoryPoint int
type CreateBacklogItemParam struct {
Type Type
Summary string
StoryPoint *int
}
func (p CreateBacklogItemParam) New() (*BacklogItem, error) {
item := &BacklogItem{
ID: ID(uuid.New()),
Type: p.Type,
Summary: p.Summary,
StoryPoint: p.StoryPoint,
}
if err := item.Validate(); err != nil {
return nil, err
}
return item, nil
}
type BacklogItem struct {
ID ID `json:"id"`
Type Type `json:"type"`
Summary string `json:"summary"`
StoryPoint *int `json:"storyPoint"`
}
func (bi BacklogItem) Validate() error {
return nil
}
type BacklogItemList []BacklogItem
type Repository interface {
Create(ctx context.Context, item *BacklogItem) error
GetOne(ctx context.Context, id ID) (*BacklogItem, error)
}
type BacklogItemQuery struct {
}
type BacklogItemNode struct {
BacklogItem
subtask.SubTaskNodeList
}
type BacklogItemNodeList []BacklogItemNode