Add Event Producer

Update User to carry webhook from circle if assigned
Refactor notification handling and update models for webhook support
This commit is contained in:
Mo Tarbin 2025-02-09 20:15:28 -05:00
parent 44cb5501dd
commit 04d1894aea
17 changed files with 351 additions and 101 deletions

View file

@ -2,6 +2,7 @@ package pushover
import (
"context"
"errors"
"donetick.com/core/config"
nModel "donetick.com/core/internal/notifier/model"
@ -22,7 +23,10 @@ func NewPushover(cfg *config.Config) *Pushover {
}
}
func (p *Pushover) SendNotification(c context.Context, notification *nModel.Notification) error {
func (p *Pushover) SendNotification(c context.Context, notification *nModel.NotificationDetails) error {
if notification.TargetID == "" {
return errors.New("unable to send notification, targetID is empty")
}
log := logging.FromContext(c)
recipient := pushover.NewRecipient(notification.TargetID)
message := pushover.NewMessageWithTitle(notification.Text, "Donetick")