gomeshalerter/models.go

43 lines
1.5 KiB
Go

package main
import (
"time"
)
type Article struct {
Title string `json:"title"`
Description string `json:"description"`
Link string `json:"link"`
Published time.Time `json:"published"` // When we first saw the article
OriginalDate time.Time `json:"originalDate"` // Original publication date from the feed
Source string `json:"source"`
FirstSeen time.Time `json:"firstseen"`
Seen time.Time `json:"seen"`
Summary string `json:"summary"`
Importance int `json:"importance"`
ID string `json:"id"`
BroadcastTime time.Time `json:"broadcastTime,omitempty"`
RelativeTime string `json:"-"` // Relative time for FirstSeen (calculated field, not stored)
BroadcastRelativeTime string `json:"-"` // Relative time for BroadcastTime (calculated field, not stored)
}
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Event string `json:"event"`
Details map[string]interface{} `json:"details"`
}
// Data structure for web UI
type DashboardData struct {
LastUpdated string
TotalArticles int
TotalBroadcast int
NewInLastHour int
UnsummarizedCount int
NextBroadcastIn string // Time until the next broadcast attempt
LastBroadcastTime time.Time // When the last broadcast occurred
NextUp []Article
History []Article
RecentLogs []LogEntry
}