/
transfer_handler.go
executable file
·41 lines (35 loc) · 1.02 KB
/
transfer_handler.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
package router
import (
"github.com/gin-gonic/gin"
"github.com/nicholasanthonys/go-recipe/adapter/api/action"
"github.com/nicholasanthonys/go-recipe/adapter/presenter"
"github.com/nicholasanthonys/go-recipe/adapter/repository"
"github.com/nicholasanthonys/go-recipe/usecase"
)
func (g ginEngine) buildCreateTransferAction() gin.HandlerFunc {
return func(c *gin.Context) {
var (
uc = usecase.NewCreateTransferInteractor(
repository.NewTransferNoSQL(g.db),
repository.NewAccountNoSQL(g.db),
presenter.NewCreateTransferPresenter(),
g.ctxTimeout,
)
act = action.NewCreateTransferAction(uc, g.log, g.validator)
)
act.Execute(c.Writer, c.Request)
}
}
func (g ginEngine) buildFindAllTransferAction() gin.HandlerFunc {
return func(c *gin.Context) {
var (
uc = usecase.NewFindAllTransferInteractor(
repository.NewTransferNoSQL(g.db),
presenter.NewFindAllTransferPresenter(),
g.ctxTimeout,
)
act = action.NewFindAllTransferAction(uc, g.log)
)
act.Execute(c.Writer, c.Request)
}
}