Add timezone-aware daily digest notifications

The daily digest notification count was inconsistent with the kanban UI
because the server used UTC time while the client used local time.
A task due Dec 24 would appear overdue on the server (UTC Dec 25) but
still show as "due today" for the user (local Dec 24).

Changes:
- Add timezone column to notification_preference table
- Auto-capture user's timezone from X-Timezone header when fetching tasks
- Use stored timezone in HandleDailyDigest for accurate overdue calculation

The mobile app already sends X-Timezone on every request, so no client
changes are needed. The timezone is captured on each app launch when
the tasks API is called.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-24 22:48:34 -06:00
parent 12ae11ca59
commit 70a56e8e96
7 changed files with 74 additions and 2 deletions

View File

@@ -33,6 +33,10 @@ type NotificationPreference struct {
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"`
// User timezone for background job calculations (IANA name, e.g., "America/Los_Angeles")
// Auto-captured from X-Timezone header on API calls
Timezone *string `gorm:"column:timezone;type:varchar(50)" json:"timezone"`
}
// TableName returns the table name for GORM