31 lines
820 B
Go
31 lines
820 B
Go
package svc
|
|
|
|
import (
|
|
"app-cloudep-notification-service/internal/config"
|
|
domainUC "app-cloudep-notification-service/internal/domain/usecase"
|
|
"app-cloudep-notification-service/internal/usecase"
|
|
|
|
"code.30cm.net/digimon/library-go/errs"
|
|
"code.30cm.net/digimon/library-go/errs/code"
|
|
|
|
v "code.30cm.net/digimon/library-go/validator"
|
|
)
|
|
|
|
type ServiceContext struct {
|
|
Config config.Config
|
|
|
|
Validate v.Validate
|
|
MailSender domainUC.MailClientUseCase
|
|
SMSSender domainUC.SMSClientUseCase
|
|
}
|
|
|
|
func NewServiceContext(c config.Config) *ServiceContext {
|
|
errs.Scope = code.CloudEPNotification
|
|
return &ServiceContext{
|
|
Config: c,
|
|
MailSender: usecase.MustMailgunUseCase(usecase.MailUseCaseParam{Conf: c}),
|
|
SMSSender: usecase.MustMitakeUseCase(usecase.SMSUseCaseParam{Conf: c}),
|
|
Validate: v.MustValidator(),
|
|
}
|
|
}
|