2025-04-17 12:44:25 +00:00
|
|
|
package initialize
|
|
|
|
|
|
|
|
import (
|
2025-04-21 10:44:11 +00:00
|
|
|
"gitea.pena/SQuiz/storer/internal/controllers/grpc_controllers/quiz_files_rpc"
|
2025-04-17 12:44:25 +00:00
|
|
|
"gitea.pena/SQuiz/storer/internal/controllers/http_controllers/quiz_files"
|
2025-04-21 10:44:11 +00:00
|
|
|
"github.com/go-redis/redis/v8"
|
2025-04-17 12:44:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ControllerDeps struct {
|
2025-04-21 10:44:11 +00:00
|
|
|
DALs *DALs
|
|
|
|
RedisClient *redis.Client
|
2025-04-17 12:44:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Controller struct {
|
|
|
|
HttpControllers HttpControllers
|
2025-04-21 10:44:11 +00:00
|
|
|
GrpcControllers GrpcControllers
|
2025-04-17 12:44:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type HttpControllers struct {
|
|
|
|
QuizFiles *quiz_files.QuizFiles
|
|
|
|
}
|
|
|
|
|
2025-04-21 10:44:11 +00:00
|
|
|
type GrpcControllers struct {
|
|
|
|
S3Deleter *quiz_files_rpc.S3Deleter
|
|
|
|
}
|
|
|
|
|
2025-04-17 12:44:25 +00:00
|
|
|
func NewControllers(deps ControllerDeps) *Controller {
|
|
|
|
return &Controller{
|
|
|
|
HttpControllers: HttpControllers{
|
|
|
|
QuizFiles: quiz_files.New(deps.DALs.StDal, deps.DALs.PgDAL),
|
|
|
|
},
|
2025-04-21 10:44:11 +00:00
|
|
|
GrpcControllers: GrpcControllers{
|
|
|
|
S3Deleter: quiz_files_rpc.NewS3Deleter(deps.RedisClient),
|
|
|
|
},
|
2025-04-17 12:44:25 +00:00
|
|
|
}
|
|
|
|
}
|