summaryrefslogtreecommitdiff
path: root/internal/models/types.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-13 14:18:24 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-13 14:18:24 -1000
commite107192be5efb65807c7da3b6aa99ce3555944d0 (patch)
tree12f9a03a0586ec79c13b3461d960ccb27d0ae117 /internal/models/types.go
parent2fee76ea41f37e3a068273c05a98b892ab29228c (diff)
Implement Todoist write operations - API layer (Part 1)
Add CreateTask and CompleteTask methods to Todoist API client: Models: - Add Project struct (ID, Name) to types.go - Add Projects []Project field to DashboardData API Interface: - Change GetProjects signature to return []models.Project - Ensure CreateTask and CompleteTask are defined Todoist Client: - Add baseURL field for testability - Refactor GetProjects to return []models.Project - Update GetTasks to build project map from new GetProjects - Implement CreateTask with JSON payload support - Implement CompleteTask using POST to /tasks/{id}/close Tests: - Create comprehensive todoist_test.go - Test CreateTask, CreateTask with due date, CompleteTask - Test error handling and GetProjects - Update mock client in handlers tests All tests pass. Ready for handlers and UI integration. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/models/types.go')
-rw-r--r--internal/models/types.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/models/types.go b/internal/models/types.go
index 31308fc..245f25f 100644
--- a/internal/models/types.go
+++ b/internal/models/types.go
@@ -60,6 +60,12 @@ type Card struct {
URL string `json:"url"`
}
+// Project represents a Todoist project
+type Project struct {
+ ID string `json:"id"`
+ Name string `json:"name"`
+}
+
// CacheMetadata tracks when data was last fetched
type CacheMetadata struct {
Key string `json:"key"`
@@ -79,6 +85,7 @@ type DashboardData struct {
Notes []Note `json:"notes"`
Meals []Meal `json:"meals"`
Boards []Board `json:"boards,omitempty"`
+ Projects []Project `json:"projects,omitempty"`
LastUpdated time.Time `json:"last_updated"`
Errors []string `json:"errors,omitempty"`
}