Update installer system for update approval functionality
Major milestone: Update installation system now works - Implemented unified installer interface with factory pattern - Created APT, DNF, and Docker installers - Integrated installer into agent command processing loop - Update approval button now actually installs packages Documentation updates: - Updated claude.md with Session 7 implementation log - Created clean, professional README.md for GitHub - Added screenshots section with 4 dashboard views - Preserved detailed development history in backup files Repository ready for GitHub alpha release with working installer functionality.
This commit is contained in:
58
aggregator-server/internal/services/timezone.go
Normal file
58
aggregator-server/internal/services/timezone.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/aggregator-project/aggregator-server/internal/config"
|
||||
)
|
||||
|
||||
type TimezoneService struct {
|
||||
config *config.Config
|
||||
}
|
||||
|
||||
func NewTimezoneService(config *config.Config) *TimezoneService {
|
||||
return &TimezoneService{
|
||||
config: config,
|
||||
}
|
||||
}
|
||||
|
||||
// GetTimezoneLocation returns the configured timezone as a time.Location
|
||||
func (s *TimezoneService) GetTimezoneLocation() (*time.Location, error) {
|
||||
return time.LoadLocation(s.config.Timezone)
|
||||
}
|
||||
|
||||
// FormatTimeForTimezone formats a time.Time according to the configured timezone
|
||||
func (s *TimezoneService) FormatTimeForTimezone(t time.Time) (time.Time, error) {
|
||||
loc, err := s.GetTimezoneLocation()
|
||||
if err != nil {
|
||||
return t, err
|
||||
}
|
||||
return t.In(loc), nil
|
||||
}
|
||||
|
||||
// GetNowInTimezone returns the current time in the configured timezone
|
||||
func (s *TimezoneService) GetNowInTimezone() (time.Time, error) {
|
||||
return s.FormatTimeForTimezone(time.Now())
|
||||
}
|
||||
|
||||
// GetAvailableTimezones returns a list of common timezones
|
||||
func (s *TimezoneService) GetAvailableTimezones() []TimezoneOption {
|
||||
return []TimezoneOption{
|
||||
{Value: "UTC", Label: "UTC (Coordinated Universal Time)"},
|
||||
{Value: "America/New_York", Label: "Eastern Time (ET)"},
|
||||
{Value: "America/Chicago", Label: "Central Time (CT)"},
|
||||
{Value: "America/Denver", Label: "Mountain Time (MT)"},
|
||||
{Value: "America/Los_Angeles", Label: "Pacific Time (PT)"},
|
||||
{Value: "Europe/London", Label: "London (GMT)"},
|
||||
{Value: "Europe/Paris", Label: "Paris (CET)"},
|
||||
{Value: "Europe/Berlin", Label: "Berlin (CET)"},
|
||||
{Value: "Asia/Tokyo", Label: "Tokyo (JST)"},
|
||||
{Value: "Asia/Shanghai", Label: "Shanghai (CST)"},
|
||||
{Value: "Australia/Sydney", Label: "Sydney (AEDT)"},
|
||||
}
|
||||
}
|
||||
|
||||
type TimezoneOption struct {
|
||||
Value string `json:"value"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
Reference in New Issue
Block a user