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:
@@ -117,12 +117,12 @@ func main() {
|
||||
}
|
||||
log.Info().Str("cron", "0 * * * *").Int("default_hour", cfg.Worker.OverdueReminderHour).Msg("Registered overdue reminder job (runs hourly for per-user times)")
|
||||
|
||||
// Schedule daily digest (runs at configured hour - no per-user customization yet)
|
||||
dailyCron := formatCron(cfg.Worker.DailyNotifHour)
|
||||
if _, err := scheduler.Register(dailyCron, asynq.NewTask(jobs.TypeDailyDigest, nil)); err != nil {
|
||||
// Schedule daily digest (runs every hour to support per-user custom times)
|
||||
// The job handler filters users based on their preferred notification hour
|
||||
if _, err := scheduler.Register("0 * * * *", asynq.NewTask(jobs.TypeDailyDigest, nil)); err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to register daily digest job")
|
||||
}
|
||||
log.Info().Str("cron", dailyCron).Msg("Registered daily digest job")
|
||||
log.Info().Str("cron", "0 * * * *").Int("default_hour", cfg.Worker.DailyNotifHour).Msg("Registered daily digest job (runs hourly for per-user times)")
|
||||
|
||||
// Handle graceful shutdown
|
||||
quit := make(chan os.Signal, 1)
|
||||
|
||||
Reference in New Issue
Block a user