Add local-first refactor foundation

This commit is contained in:
2026-05-25 00:45:46 -04:00
parent 161e871c53
commit 517c6b987b
45 changed files with 11545 additions and 697 deletions

106
internal/store/models.go Normal file
View File

@@ -0,0 +1,106 @@
package store
import "time"
// RawPayload stores a fetched source payload with provenance metadata.
type RawPayload struct {
ID int64
Source string
Endpoint string
RequestKey string
MeetingKey *int
SessionKey *int
Payload string
PayloadHash string
FetchedAt time.Time
ProvenanceJSON string
}
// IngestionRun tracks a scoped ingestion attempt.
type IngestionRun struct {
ID int64
ScopeType string
ScopeKey string
StartedAt time.Time
FinishedAt *time.Time
Status string
Refresh bool
SummaryJSON string
}
// Meeting is a race weekend record.
type Meeting struct {
MeetingKey int
MeetingName string
MeetingOfficialName string
Location string
CountryCode string
CountryName string
CircuitKey int
CircuitShortName string
GMTOffset string
DateStart string
DateEnd string
Year int
UpdatedAt time.Time
}
// Session is a session within a meeting.
type Session struct {
SessionKey int
MeetingKey int
SessionName string
SessionType string
CircuitKey int
DateStart string
DateEnd string
GMTOffset string
UpdatedAt time.Time
}
// Driver is a driver identity record.
type Driver struct {
DriverNumber int
BroadcastName string
FirstName string
FullName string
LastName string
NameAcronym string
HeadshotURL string
TeamName string
TeamColour string
UpdatedAt time.Time
}
// SessionDriver links a driver to a session with session-specific team info.
type SessionDriver struct {
SessionKey int
DriverNumber int
MeetingKey int
TeamName string
TeamColour string
}
// SessionResult is a final classification row for a session.
type SessionResult struct {
SessionKey int
DriverNumber int
MeetingKey int
Position int
Points float64
NumberOfLaps int
DurationJSON string
GapToLeaderJSON string
DNF bool
DNS bool
DSQ bool
}
// StartingGridEntry is a starting grid position for a session.
type StartingGridEntry struct {
SessionKey int
DriverNumber int
MeetingKey int
Position int
LapDuration float64
}