37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package main
|
|
|
|
// Домен уведомлений.
|
|
// Этим файлом владеет команда уведомлений.
|
|
//
|
|
// Что внутри: отправка уведомлений, шаблоны, каналы доставки.
|
|
// Что НЕ знает: как устроена авторизация, как устроены профили внутри.
|
|
|
|
import "go.uber.org/fx"
|
|
|
|
var NotificationModule = fx.Module("notification",
|
|
fx.Provide(
|
|
newNotificationRepo,
|
|
newNotificationService,
|
|
),
|
|
)
|
|
|
|
// --- NotificationRepo ---
|
|
|
|
type notificationRepo struct{ db DB }
|
|
|
|
func newNotificationRepo(db DB) NotificationRepository {
|
|
return ¬ificationRepo{db: db}
|
|
}
|
|
|
|
// --- NotificationService ---
|
|
|
|
type notificationServiceImpl struct {
|
|
notificationRepo NotificationRepository
|
|
userService UserService
|
|
events EventBus
|
|
}
|
|
|
|
func newNotificationService(notificationRepo NotificationRepository, userService UserService, events EventBus) NotificationService {
|
|
return ¬ificationServiceImpl{notificationRepo: notificationRepo, userService: userService, events: events}
|
|
}
|