app-cloudep-notification-se.../internal/svc/service_context.go

31 lines
820 B
Go
Raw Normal View History

2024-08-20 06:35:14 +00:00
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"
)
2024-08-20 06:35:14 +00:00
type ServiceContext struct {
Config config.Config
Validate v.Validate
MailSender domainUC.MailClientUseCase
SMSSender domainUC.SMSClientUseCase
2024-08-20 06:35:14 +00:00
}
func NewServiceContext(c config.Config) *ServiceContext {
errs.Scope = code.CloudEPNotification
2024-08-20 06:35:14 +00:00
return &ServiceContext{
Config: c,
MailSender: usecase.MustMailgunUseCase(usecase.MailUseCaseParam{Conf: c}),
SMSSender: usecase.MustMitakeUseCase(usecase.SMSUseCaseParam{Conf: c}),
Validate: v.MustValidator(),
2024-08-20 06:35:14 +00:00
}
}