From 5be6fec4089d422fb15d725badc8dd6bd8c4d6df Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Wed, 29 Apr 2026 20:32:38 -0400 Subject: [PATCH] fix(auth): resolve compile errors in timezone update handler The timezone update block in UpdateProfile() referenced undefined variables ctx and userUUID, causing a compile error. Fixed to use c.Request().Context() and targetUserUUID which are the correct variables in that handler scope. Also added Timezone field to AdminUpdateUserRequest struct so the timezone value is properly bound from JSON requests, since UpdateProfile() binds to AdminUpdateUserRequest rather than UpdateProfileRequest. --- internal/handlers/auth.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/handlers/auth.go b/internal/handlers/auth.go index 16fa9bf..242f251 100644 --- a/internal/handlers/auth.go +++ b/internal/handlers/auth.go @@ -96,6 +96,7 @@ type AdminUpdateUserRequest struct { FirstName string `json:"first_name,omitempty" validate:"omitempty,max=100"` LastName string `json:"last_name,omitempty" validate:"omitempty,max=100"` Theme string `json:"theme,omitempty" validate:"omitempty"` + Timezone string `json:"timezone,omitempty" validate:"omitempty"` Role string `json:"role,omitempty" validate:"omitempty,oneof=user admin"` } @@ -572,8 +573,8 @@ func (h *AuthHandler) UpdateProfile(c *echo.Context) error { "error": "Invalid timezone", }) } - err := h.db.UpdateUserTimezone(ctx, database.UpdateUserTimezoneParams{ - ID: pgtype.UUID{Bytes: userUUID, Valid: true}, + err := h.db.UpdateUserTimezone(c.Request().Context(), database.UpdateUserTimezoneParams{ + ID: targetUserUUID, Timezone: pgtype.Text{String: req.Timezone, Valid: true}, }) if err != nil {