summaryrefslogtreecommitdiff
path: root/internal/models
diff options
context:
space:
mode:
Diffstat (limited to 'internal/models')
-rw-r--r--internal/models/atom.go25
-rw-r--r--internal/models/atom_test.go31
-rw-r--r--internal/models/claudomator.go14
3 files changed, 66 insertions, 4 deletions
diff --git a/internal/models/atom.go b/internal/models/atom.go
index 767ccdd..3d9ce54 100644
--- a/internal/models/atom.go
+++ b/internal/models/atom.go
@@ -9,10 +9,11 @@ import (
type AtomSource string
const (
- SourceTrello AtomSource = "trello"
- SourceTodoist AtomSource = "todoist"
- SourceMeal AtomSource = "plantoeat"
- SourceGTasks AtomSource = "gtasks"
+ SourceTrello AtomSource = "trello"
+ SourceTodoist AtomSource = "todoist"
+ SourceMeal AtomSource = "plantoeat"
+ SourceGTasks AtomSource = "gtasks"
+ SourceClaudomator AtomSource = "claudomator"
)
type AtomType string
@@ -123,6 +124,22 @@ func CardToAtom(c Card) Atom {
}
}
+// StoryToAtom converts a ClaudomatorStory to an Atom
+func StoryToAtom(s ClaudomatorStory) Atom {
+ return Atom{
+ ID: s.ID,
+ Title: s.Title,
+ Description: s.Description + " [" + s.ProjectID + "]",
+ Source: SourceClaudomator,
+ Type: TypeTask,
+ Priority: 3,
+ SourceIcon: "🤖",
+ ColorClass: "border-purple-500",
+ CreatedAt: s.CreatedAt,
+ Raw: s,
+ }
+}
+
// GoogleTaskToAtom converts a Google Task to an Atom
func GoogleTaskToAtom(t GoogleTask) Atom {
// Google Tasks don't have explicit priority, default to medium (2)
diff --git a/internal/models/atom_test.go b/internal/models/atom_test.go
index 70bc14b..53bf343 100644
--- a/internal/models/atom_test.go
+++ b/internal/models/atom_test.go
@@ -262,6 +262,37 @@ func TestTimelineItem_ComputeDaySection(t *testing.T) {
}
}
+func TestStoryToAtom_Fields(t *testing.T) {
+ story := ClaudomatorStory{
+ ID: "s1",
+ Title: "Fix auth",
+ Description: "desc",
+ Status: "IN_PROGRESS",
+ ProjectID: "nav",
+ }
+
+ atom := StoryToAtom(story)
+
+ if atom.Source != SourceClaudomator {
+ t.Errorf("Expected source 'claudomator', got '%s'", atom.Source)
+ }
+ if atom.SourceIcon != "🤖" {
+ t.Errorf("Expected SourceIcon '🤖', got '%s'", atom.SourceIcon)
+ }
+ if atom.ColorClass != "border-purple-500" {
+ t.Errorf("Expected ColorClass 'border-purple-500', got '%s'", atom.ColorClass)
+ }
+ if atom.Priority != 3 {
+ t.Errorf("Expected Priority 3, got %d", atom.Priority)
+ }
+ if atom.Title != "Fix auth" {
+ t.Errorf("Expected Title 'Fix auth', got '%s'", atom.Title)
+ }
+ if atom.Description != "desc [nav]" {
+ t.Errorf("Expected Description 'desc [nav]', got '%s'", atom.Description)
+ }
+}
+
func TestCacheMetadata_IsCacheValid(t *testing.T) {
t.Run("valid cache", func(t *testing.T) {
cm := CacheMetadata{
diff --git a/internal/models/claudomator.go b/internal/models/claudomator.go
new file mode 100644
index 0000000..0883de3
--- /dev/null
+++ b/internal/models/claudomator.go
@@ -0,0 +1,14 @@
+package models
+
+import "time"
+
+type ClaudomatorStory struct {
+ ID string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ ProjectID string `json:"project_id"`
+ BranchName string `json:"branch_name"`
+ CreatedAt time.Time `json:"created_at"`
+ UpdatedAt time.Time `json:"updated_at"`
+}