Skip to content

Commit

Permalink
fix: convert refreshed_at to UTC before updating
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmingtay committed Jan 16, 2025
1 parent f72f0ee commit bc8ec43
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/models/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func (s *Session) LastRefreshedAt(refreshTokenTime *time.Time) time.Time {
}

func (s *Session) UpdateOnlyRefreshInfo(tx *storage.Connection) error {
// TODO(kangmingtay): The underlying database type uses timestamp without timezone,
// so we need to convert the value to UTC before updating it.
// In the future, we should add a migration to update the type to contain the timezone.
*s.RefreshedAt = s.RefreshedAt.UTC()
return tx.UpdateOnly(s, "refreshed_at", "user_agent", "ip")
}

Expand Down

0 comments on commit bc8ec43

Please sign in to comment.