41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
|
package initialize
|
||
|
|
||
|
import (
|
||
|
"github.com/go-redis/redis/v8"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/answerer/internal/controllers/http_controllers/common"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/utils"
|
||
|
)
|
||
|
|
||
|
type ControllerDeps struct {
|
||
|
DALs *DALs
|
||
|
Config Config
|
||
|
RedisClient *redis.Client
|
||
|
WorkerRespondentCh chan<- []model.Answer
|
||
|
WorkerSendClientCh chan<- model.Answer
|
||
|
Encrypt *utils.Encrypt
|
||
|
}
|
||
|
|
||
|
type Controller struct {
|
||
|
HttpControllers HttpControllers
|
||
|
}
|
||
|
|
||
|
type HttpControllers struct {
|
||
|
Common *common.Common
|
||
|
}
|
||
|
|
||
|
func NewControllers(deps ControllerDeps) *Controller {
|
||
|
return &Controller{
|
||
|
HttpControllers: HttpControllers{
|
||
|
Common: common.NewCommonController(common.Deps{
|
||
|
Store: deps.DALs.BlobStore,
|
||
|
Dal: deps.DALs.PgDAL,
|
||
|
WorkerRespondentCh: deps.WorkerRespondentCh,
|
||
|
WorkerSendClientCh: deps.WorkerSendClientCh,
|
||
|
Encrypt: deps.Encrypt,
|
||
|
RedirectURl: deps.Config.RedirectURL,
|
||
|
}),
|
||
|
},
|
||
|
}
|
||
|
}
|