Add timezone to admin interface user and notification prefs views
Shows the user's auto-captured timezone (IANA format) in: - Notification preferences list/detail/update responses - User detail response 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@ type UserDetailResponse struct {
|
||||
UserResponse
|
||||
Residences []ResidenceSummary `json:"residences,omitempty"`
|
||||
Devices []DeviceSummary `json:"devices,omitempty"`
|
||||
Timezone *string `json:"timezone,omitempty"` // IANA timezone (auto-captured from mobile app)
|
||||
}
|
||||
|
||||
// ResidenceSummary is a brief residence representation
|
||||
|
||||
@@ -44,6 +44,9 @@ type NotificationPrefResponse struct {
|
||||
WarrantyExpiringHour *int `json:"warranty_expiring_hour"`
|
||||
DailyDigestHour *int `json:"daily_digest_hour"`
|
||||
|
||||
// User timezone (IANA name, auto-captured from X-Timezone header)
|
||||
Timezone *string `json:"timezone"`
|
||||
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
@@ -123,6 +126,7 @@ func (h *AdminNotificationPrefsHandler) List(c echo.Context) error {
|
||||
TaskOverdueHour: pref.TaskOverdueHour,
|
||||
WarrantyExpiringHour: pref.WarrantyExpiringHour,
|
||||
DailyDigestHour: pref.DailyDigestHour,
|
||||
Timezone: pref.Timezone,
|
||||
CreatedAt: pref.CreatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
UpdatedAt: pref.UpdatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
}
|
||||
@@ -166,6 +170,7 @@ func (h *AdminNotificationPrefsHandler) Get(c echo.Context) error {
|
||||
TaskOverdueHour: pref.TaskOverdueHour,
|
||||
WarrantyExpiringHour: pref.WarrantyExpiringHour,
|
||||
DailyDigestHour: pref.DailyDigestHour,
|
||||
Timezone: pref.Timezone,
|
||||
CreatedAt: pref.CreatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
UpdatedAt: pref.UpdatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
})
|
||||
@@ -275,6 +280,7 @@ func (h *AdminNotificationPrefsHandler) Update(c echo.Context) error {
|
||||
TaskOverdueHour: pref.TaskOverdueHour,
|
||||
WarrantyExpiringHour: pref.WarrantyExpiringHour,
|
||||
DailyDigestHour: pref.DailyDigestHour,
|
||||
Timezone: pref.Timezone,
|
||||
CreatedAt: pref.CreatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
UpdatedAt: pref.UpdatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
})
|
||||
@@ -333,6 +339,7 @@ func (h *AdminNotificationPrefsHandler) GetByUser(c echo.Context) error {
|
||||
TaskOverdueHour: pref.TaskOverdueHour,
|
||||
WarrantyExpiringHour: pref.WarrantyExpiringHour,
|
||||
DailyDigestHour: pref.DailyDigestHour,
|
||||
Timezone: pref.Timezone,
|
||||
CreatedAt: pref.CreatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
UpdatedAt: pref.UpdatedAt.Format("2006-01-02T15:04:05Z"),
|
||||
})
|
||||
|
||||
@@ -109,6 +109,12 @@ func (h *AdminUserHandler) Get(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
// Add timezone from notification preferences
|
||||
var prefs models.NotificationPreference
|
||||
if err := h.db.Where("user_id = ?", user.ID).First(&prefs).Error; err == nil {
|
||||
response.Timezone = prefs.Timezone
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user