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

27 lines
693 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"
2024-08-20 15:53:20 +00:00
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 {
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
}
}