feat: notification enhancement
This commit is contained in:
@@ -213,7 +213,8 @@ func (s *Server) initAuth(cfg *config.Config, logger *zap.Logger) {
|
||||
pushRepo := repository.NewPushRepo(s.pg)
|
||||
pushSender := service.NewPushSender(pushRepo, cfg.VAPIDPublicKey, cfg.VAPIDPrivateKey, cfg.VAPIDSubject, logger)
|
||||
s.pushH = handler.NewPushHandler(pushSender, pushRepo)
|
||||
notifSvc := service.NewNotificationService(notifRepo, userRepo, mail, rtClient, pushSender, logger, cfg.FrontendURL)
|
||||
notifPrefsRepo := repository.NewNotificationPrefsRepo(s.pg)
|
||||
notifSvc := service.NewNotificationService(notifRepo, notifPrefsRepo, userRepo, mail, rtClient, pushSender, logger, cfg.FrontendURL)
|
||||
// Wire the notification seam into the post service so a new like notifies
|
||||
// the author (push + realtime; not the liker themselves).
|
||||
postSvc.SetNotifier(notifSvc)
|
||||
@@ -222,7 +223,7 @@ func (s *Server) initAuth(cfg *config.Config, logger *zap.Logger) {
|
||||
// websocket) to chant / post a quote at their local time. Shares the
|
||||
// notification seam above so all three channels fire.
|
||||
reminderRepo := repository.NewReminderRepo(s.pg)
|
||||
reminderSvc := service.NewReminderService(reminderRepo, notifSvc, logger, cfg.FrontendURL)
|
||||
reminderSvc := service.NewReminderService(reminderRepo, notifPrefsRepo, notifSvc, logger, cfg.FrontendURL)
|
||||
s.reminderH = handler.NewReminderHandler(reminderSvc)
|
||||
wctx := s.workerCtx
|
||||
if wctx == nil {
|
||||
@@ -799,6 +800,10 @@ func (s *Server) setupRouter() {
|
||||
r.Get("/", s.notificationH.List)
|
||||
r.Get("/unread-count", s.notificationH.UnreadCount)
|
||||
r.Post("/read", s.notificationH.MarkAllRead)
|
||||
r.Get("/prefs", s.notificationH.GetPrefs)
|
||||
r.Put("/prefs", s.notificationH.UpdatePrefs)
|
||||
// Legacy single-toggle endpoints — shims over /prefs, kept until
|
||||
// old clients are gone.
|
||||
r.Get("/email-prefs", s.notificationH.GetEmailPrefs)
|
||||
r.Put("/email-prefs", s.notificationH.UpdateEmailPrefs)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user