sync - build workin

This commit is contained in:
2025-09-20 19:04:12 -07:00
parent 626c473b01
commit 9d1566cfdf
14 changed files with 319 additions and 279 deletions

View File

@@ -6,12 +6,17 @@ import (
"sort"
"time"
shared "go-garth/shared/interfaces"
types "go-garth/internal/models/types"
shared "go-garth/shared/interfaces"
)
// Update the existing get method in hrv.go
func (h *types.DailyHRVData) Get(day time.Time, c shared.APIClient) (interface{}, error) {
// DailyHRVDataWithMethods embeds types.DailyHRVData and adds methods
type DailyHRVDataWithMethods struct {
types.DailyHRVData
}
// Get implements the Data interface for DailyHRVData
func (h *DailyHRVDataWithMethods) Get(day time.Time, c shared.APIClient) (interface{}, error) {
dateStr := day.Format("2006-01-02")
path := fmt.Sprintf("/wellness-service/wellness/dailyHrvData/%s?date=%s",
c.GetUsername(), dateStr)
@@ -36,7 +41,7 @@ func (h *types.DailyHRVData) Get(day time.Time, c shared.APIClient) (interface{}
// Combine summary and readings
response.HRVSummary.HRVReadings = response.HRVReadings
return &response.HRVSummary, nil
return &DailyHRVDataWithMethods{DailyHRVData: response.HRVSummary}, nil
}
// ParseHRVReadings converts body battery values array to structured readings
@@ -68,4 +73,4 @@ func ParseHRVReadings(valuesArray [][]any) []types.HRVReading {
return readings[i].Timestamp < readings[j].Timestamp
})
return readings
}
}