summaryrefslogtreecommitdiff
path: root/internal/models
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-25 11:56:29 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-25 11:56:29 -1000
commitec8a9c0ea46dec7d26caa763e3adefcaf3fc7552 (patch)
tree1f91bbc7ec87314189a441c53b7c3b25f1817db0 /internal/models
parent83beddfab9584ae4b64a782c978236472b6d5745 (diff)
Fix bugs and add bug management scripts
Bug fixes: - #36: Hide recurring tasks until due day (add IsRecurring to Task/Atom) - Trello cards missing: change filter=visible to filter=open - Build fix: add missing fmt import in atom.go Infrastructure: - Add scripts/bugs and scripts/resolve-bug for DB bug tracking - Remove issues/ directory (bugs now tracked in DB) - Add timeline_logic_test.go Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/models')
-rw-r--r--internal/models/atom.go40
-rw-r--r--internal/models/types.go8
2 files changed, 42 insertions, 6 deletions
diff --git a/internal/models/atom.go b/internal/models/atom.go
index 10d14d1..3e08896 100644
--- a/internal/models/atom.go
+++ b/internal/models/atom.go
@@ -1,6 +1,9 @@
package models
-import "time"
+import (
+ "fmt"
+ "time"
+)
type AtomSource string
@@ -8,6 +11,7 @@ const (
SourceTrello AtomSource = "trello"
SourceTodoist AtomSource = "todoist"
SourceMeal AtomSource = "plantoeat"
+ SourceBug AtomSource = "bug"
)
type AtomType string
@@ -16,6 +20,7 @@ const (
TypeTask AtomType = "task"
TypeNote AtomType = "note"
TypeMeal AtomType = "meal"
+ TypeBug AtomType = "bug"
)
// Atom represents a unified unit of work or information
@@ -34,11 +39,12 @@ type Atom struct {
Priority int // Normalized: 1 (Low) to 4 (Urgent)
// UI Helpers (to be populated by mappers)
- SourceIcon string // e.g., "trello-icon.svg" or emoji
- ColorClass string // e.g., "border-blue-500"
- IsOverdue bool // True if due date is before today
- IsFuture bool // True if due date is after today
- HasSetTime bool // True if due time is not midnight (has specific time)
+ SourceIcon string // e.g., "trello-icon.svg" or emoji
+ ColorClass string // e.g., "border-blue-500"
+ IsOverdue bool // True if due date is before today
+ IsFuture bool // True if due date is after today
+ HasSetTime bool // True if due time is not midnight (has specific time)
+ IsRecurring bool // True if this is a recurring task
// Original Data (for write operations)
Raw interface{}
@@ -89,6 +95,7 @@ func TaskToAtom(t Task) Atom {
Priority: priority,
SourceIcon: "🔴", // Red circle for Todoist
ColorClass: "border-red-500",
+ IsRecurring: t.IsRecurring,
Raw: t,
}
}
@@ -135,3 +142,24 @@ func MealToAtom(m Meal) Atom {
Raw: m,
}
}
+
+// BugToAtom converts a Bug to an Atom
+func BugToAtom(b Bug) Atom {
+ // Bugs get high priority (3) to encourage fixing
+ priority := 3
+
+ return Atom{
+ ID: fmt.Sprintf("bug-%d", b.ID),
+ Title: b.Description,
+ Description: "Bug Report",
+ Source: SourceBug,
+ Type: TypeBug,
+ URL: "",
+ DueDate: nil, // Bugs don't have due dates
+ CreatedAt: b.CreatedAt,
+ Priority: priority,
+ SourceIcon: "🐛",
+ ColorClass: "border-red-700",
+ Raw: b,
+ }
+}
diff --git a/internal/models/types.go b/internal/models/types.go
index f45e346..0284a3a 100644
--- a/internal/models/types.go
+++ b/internal/models/types.go
@@ -15,6 +15,7 @@ type Task struct {
Labels []string `json:"labels"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
+ IsRecurring bool `json:"is_recurring"`
}
// Meal represents a meal from PlanToEat
@@ -100,6 +101,13 @@ type CalendarEvent struct {
HTMLLink string `json:"html_link"`
}
+// Bug represents a bug report
+type Bug struct {
+ ID int64 `json:"id"`
+ Description string `json:"description"`
+ CreatedAt time.Time `json:"created_at"`
+}
+
// CacheMetadata tracks when data was last fetched
type CacheMetadata struct {
Key string `json:"key"`