-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.go
43 lines (32 loc) · 982 Bytes
/
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
42
43
package handler
import (
"github.com/gohugonet/hugoverse/internal/application"
"github.com/gohugonet/hugoverse/internal/interfaces/api/admin"
"github.com/gohugonet/hugoverse/internal/interfaces/api/auth"
"github.com/gohugonet/hugoverse/internal/interfaces/api/database"
"github.com/gohugonet/hugoverse/pkg/log"
)
type Handler struct {
res *Response
log log.Logger
uploadDir string
db *database.Database
contentApp *application.ContentServer
adminApp *application.AdminServer
adminView *admin.View
auth *auth.Auth
}
func New(log log.Logger, uploadDir string, db *database.Database,
contentApp *application.ContentServer, adminApp *application.AdminServer) *Handler {
adminView := admin.NewView(adminApp.Name(), contentApp.AllContentTypes())
return &Handler{
res: NewResponse(adminView),
log: log,
uploadDir: uploadDir,
db: db,
contentApp: contentApp,
adminApp: adminApp,
adminView: adminView,
auth: &auth.Auth{},
}
}