spaxel/mothership/internal/briefing/notify_adapter.go
jedarden 1a52dde111 feat: implement morning briefing feature
Add daily summary card with push notification option.

- Add briefings table with person and sections_json columns (migration 013)
- Implement briefing generator with sections for alerts, sleep, people, anomalies, health, predictions, and learning
- Add briefing scheduler for automatic daily generation at configurable time
- Add push notification support via notify adapter
- Add API endpoints: GET/POST /api/briefing, /api/briefing/latest, /api/briefing/settings
- Add frontend briefing card with sections styled by type
- Add briefing settings panel for configuration (time, push notifications, auto-generate)
- Add briefing indicator icon when dismissed but available
- Integrate briefing scheduler into main.go with providers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 00:25:33 -04:00

38 lines
1,020 B
Go

// Package briefing provides notification adapter for the briefing scheduler.
package briefing
import (
"log"
"github.com/spaxel/mothership/internal/notify"
)
// NotifyAdapter adapts the notify.Service to the briefing NotifyService interface.
type NotifyAdapter struct {
service *notify.Service
}
// NewNotifyAdapter creates a new notification adapter.
func NewNotifyAdapter(svc *notify.Service) *NotifyAdapter {
return &NotifyAdapter{service: svc}
}
// Send sends a notification through the notify service.
func (a *NotifyAdapter) Send(notification Notification) error {
if a.service == nil {
log.Printf("[WARN] Notification service not available, skipping: %s", notification.Title)
return nil
}
notif := notify.Notification{
Title: notification.Title,
Body: notification.Body,
Priority: notification.Priority,
Tags: notification.Tags,
Image: notification.Image,
ImageType: notification.ImageType,
Timestamp: notification.Timestamp,
}
return a.service.Send(notif)
}