Add Daily Digest notification preferences with custom time support

- Add daily_digest boolean and daily_digest_hour fields to NotificationPreference model
- Update HandleDailyDigest to check user preferences and custom notification times
- Change Daily Digest scheduler to run hourly (supports per-user custom times)
- Update notification service DTOs for new fields
- Add Daily Digest toggle and custom time to admin notification prefs page
- Fix notification handlers to only notify users at their designated hour

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-07 22:48:18 -06:00
parent 0ea0c766ea
commit f88409cfb4
7 changed files with 134 additions and 71 deletions

View File

@@ -21,6 +21,9 @@ type NotificationPreference struct {
// Document notifications
WarrantyExpiring bool `gorm:"column:warranty_expiring;default:true" json:"warranty_expiring"`
// Summary notifications
DailyDigest bool `gorm:"column:daily_digest;default:true" json:"daily_digest"`
// Email preferences
EmailTaskCompleted bool `gorm:"column:email_task_completed;default:true" json:"email_task_completed"`
@@ -29,6 +32,7 @@ type NotificationPreference struct {
TaskDueSoonHour *int `gorm:"column:task_due_soon_hour" json:"task_due_soon_hour"`
TaskOverdueHour *int `gorm:"column:task_overdue_hour" json:"task_overdue_hour"`
WarrantyExpiringHour *int `gorm:"column:warranty_expiring_hour" json:"warranty_expiring_hour"`
DailyDigestHour *int `gorm:"column:daily_digest_hour" json:"daily_digest_hour"`
}
// TableName returns the table name for GORM