2024-08-20 06:35:14 +00:00
|
|
|
package svc
|
|
|
|
|
2024-08-20 13:08:00 +00:00
|
|
|
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
|
|
|
|
2024-08-20 13:08:00 +00:00
|
|
|
v "code.30cm.net/digimon/library-go/validator"
|
|
|
|
)
|
2024-08-20 06:35:14 +00:00
|
|
|
|
|
|
|
type ServiceContext struct {
|
|
|
|
Config config.Config
|
2024-08-20 13:08:00 +00:00
|
|
|
|
|
|
|
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{
|
2024-08-20 13:08:00 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|