fix: preserve typed growth report revisions

This commit is contained in:
2026-08-21 00:43:31 +03:30
parent 49084ea577
commit dd0ae15a95
3 changed files with 29 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ package growthreport
import (
"encoding/json"
"fmt"
"time"
)
@@ -44,11 +45,12 @@ type Usage struct {
type Report struct {
ReportID string `json:"reportId"`
Revision int `json:"revision"`
Status Status `json:"status"`
Scope Scope `json:"scope"`
HorizonDays int `json:"horizonDays"`
ForecastStartDate *time.Time `json:"forecastStartDate,omitempty"`
DeterministicEvidence json.RawMessage `json:"deterministicEvidence"`
DeterministicEvidence json.RawMessage `json:"deterministicEvidence,omitempty"`
AICopy *AICopy `json:"aiCopy,omitempty"`
FailureCode *string `json:"failureCode,omitempty"`
Cached bool `json:"cached"`
@@ -79,3 +81,10 @@ type CreateRequest struct {
TerminalID string `json:"terminalId"`
Refresh bool `json:"refresh"`
}
type RefreshLimitError struct{ NextRefreshAt time.Time }
func (e *RefreshLimitError) Error() string {
return fmt.Sprintf("%s: next refresh at %s", ErrRefreshLimited, e.NextRefreshAt.Format(time.RFC3339))
}
func (e *RefreshLimitError) Unwrap() error { return ErrRefreshLimited }