diff options
Diffstat (limited to 'internal/models')
| -rw-r--r-- | internal/models/timeline.go | 30 | ||||
| -rw-r--r-- | internal/models/types.go | 7 |
2 files changed, 34 insertions, 3 deletions
diff --git a/internal/models/timeline.go b/internal/models/timeline.go index 4a619fa..469cce4 100644 --- a/internal/models/timeline.go +++ b/internal/models/timeline.go @@ -11,6 +11,14 @@ const ( TimelineItemTypeEvent TimelineItemType = "event" ) +type DaySection string + +const ( + DaySectionToday DaySection = "today" + DaySectionTomorrow DaySection = "tomorrow" + DaySectionLater DaySection = "later" +) + type TimelineItem struct { ID string `json:"id"` Type TimelineItemType `json:"type"` @@ -20,4 +28,26 @@ type TimelineItem struct { Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` OriginalItem interface{} `json:"-"` + + // UI enhancement fields + IsCompleted bool `json:"is_completed"` + DaySection DaySection `json:"day_section"` + Source string `json:"source"` // "todoist", "trello", "plantoeat", "calendar" +} + +// ComputeDaySection sets the DaySection based on the item's time +func (item *TimelineItem) ComputeDaySection(now time.Time) { + today := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + tomorrow := today.AddDate(0, 0, 1) + dayAfterTomorrow := today.AddDate(0, 0, 2) + + itemDay := time.Date(item.Time.Year(), item.Time.Month(), item.Time.Day(), 0, 0, 0, 0, item.Time.Location()) + + if itemDay.Before(tomorrow) { + item.DaySection = DaySectionToday + } else if itemDay.Before(dayAfterTomorrow) { + item.DaySection = DaySectionTomorrow + } else { + item.DaySection = DaySectionLater + } } diff --git a/internal/models/types.go b/internal/models/types.go index 0284a3a..6dc8716 100644 --- a/internal/models/types.go +++ b/internal/models/types.go @@ -103,9 +103,10 @@ type CalendarEvent struct { // Bug represents a bug report type Bug struct { - ID int64 `json:"id"` - Description string `json:"description"` - CreatedAt time.Time `json:"created_at"` + ID int64 `json:"id"` + Description string `json:"description"` + CreatedAt time.Time `json:"created_at"` + ResolvedAt *time.Time `json:"resolved_at,omitempty"` } // CacheMetadata tracks when data was last fetched |
