-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
109 lines (97 loc) · 2.16 KB
/
main.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package main
import (
"fmt"
"os"
"time"
"github.com/x-color/vue-trello/interface/controller/api"
"github.com/x-color/vue-trello/interface/presenter/logging"
"github.com/x-color/vue-trello/interface/repository/rdb"
"github.com/x-color/vue-trello/model"
"github.com/x-color/vue-trello/usecase"
)
func main() {
dbm, err := rdb.NewDBManager()
if err != nil {
fmt.Println(err)
return
}
// Add init tags.
tx := dbm.TransactionManager.BeginTransaction(false)
dbm.TagDBManager.Create(tx, model.Tag{ID: "0", Name: "t1", Color: model.RED})
dbm.TagDBManager.Create(tx, model.Tag{ID: "1", Name: "t2", Color: model.YELLOW})
dbm.TagDBManager.Create(tx, model.Tag{ID: "2", Name: "t3", Color: model.GREEN})
dbm.TagDBManager.Create(tx, model.Tag{ID: "3", Name: "t4", Color: model.BLUE})
location, err := time.LoadLocation("Asia/Tokyo")
if err != nil {
location = time.FixedZone("Asia/Tokyo", 9*60*60)
}
logger, err := logging.NewLogger(os.Stdout, location)
if err != nil {
fmt.Println(err)
return
}
itemIntera, err := usecase.NewItemInteractor(
&dbm.TransactionManager,
&dbm.ItemDBManager,
&dbm.ListDBManager,
&dbm.TagDBManager,
&logger,
)
if err != nil {
fmt.Println(err)
return
}
listIntera, err := usecase.NewListInteractor(
&dbm.TransactionManager,
&dbm.ItemDBManager,
&dbm.ListDBManager,
&dbm.BoardDBManager,
&logger,
)
if err != nil {
fmt.Println(err)
return
}
boardIntera, err := usecase.NewBoardInteractor(
&dbm.TransactionManager,
&dbm.BoardDBManager,
&dbm.ListDBManager,
&dbm.ItemDBManager,
&logger,
)
if err != nil {
fmt.Println(err)
return
}
userIntera, err := usecase.NewUserInteractor(
&dbm.TransactionManager,
&dbm.UserDBManager,
&logger,
)
if err != nil {
fmt.Println(err)
return
}
resourceIntera, err := usecase.NewResourceInteractor(
&dbm.TransactionManager,
&dbm.TagDBManager,
&logger,
)
if err != nil {
fmt.Println(err)
return
}
interaBox, err := api.NewInteraBox(
&itemIntera,
&listIntera,
&boardIntera,
&userIntera,
&resourceIntera,
)
if err != nil {
fmt.Println(err)
return
}
router := api.NewRouter(interaBox)
router.Logger.Fatal(router.Start(":8080"))
}