summaryrefslogtreecommitdiff
path: root/internal/handlers/handlers.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-04 11:12:44 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-03-04 11:12:44 -1000
commit0fd54eddc40f517cf491310d4f8a60b0d79dc937 (patch)
treeb026328a49b9583efb7c94b3777830c31c46fa33 /internal/handlers/handlers.go
parent4853a4a917bb7942776ffd8b3e003ee03fc49160 (diff)
feat: sync log, cache clear endpoint, Todoist projects from cached tasks
- migration 016: sync_log table - store: AddSyncLogEntry, GetRecentSyncLog, InvalidateAllCaches, GetProjectsFromTasks - settings: HandleClearCache (POST /settings/clear-cache), SyncLog in page data - settings: use GetProjectsFromTasks instead of deprecated Todoist REST /projects - handlers: populate atom projects from store - agent: log warning on registration failure instead of silently swallowing - google_tasks: simplify URL literal - tests: sync log CRUD, clear cache handler, settings page includes sync log, sync sources adds log entry, incremental sync paths, task completion response/headers, calendar cache fallback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/handlers/handlers.go')
-rw-r--r--internal/handlers/handlers.go23
1 files changed, 6 insertions, 17 deletions
diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go
index e06c35e..4988038 100644
--- a/internal/handlers/handlers.go
+++ b/internal/handlers/handlers.go
@@ -243,16 +243,6 @@ func (h *Handler) aggregateData(ctx context.Context, forceRefresh bool) (*models
return err
})
- fetch("Projects", func() error {
- projects, err := h.todoistClient.GetProjects(ctx)
- if err == nil {
- mu.Lock()
- data.Projects = projects
- mu.Unlock()
- }
- return err
- })
-
if h.planToEatClient != nil {
fetch("PlanToEat", func() error {
meals, err := h.fetchMeals(ctx, forceRefresh)
@@ -279,6 +269,11 @@ func (h *Handler) aggregateData(ctx context.Context, forceRefresh bool) (*models
wg.Wait()
+ // Populate projects from cached tasks (avoids deprecated REST API)
+ if projects, err := h.store.GetProjectsFromTasks(); err == nil {
+ data.Projects = projects
+ }
+
// Extract and sort Trello tasks
data.TrelloTasks = filterAndSortTrelloTasks(data.Boards)
@@ -586,7 +581,7 @@ func (h *Handler) HandleCreateTask(w http.ResponseWriter, r *http.Request) {
return
}
- projects, _ := h.todoistClient.GetProjects(ctx)
+ projects, _ := h.store.GetProjectsFromTasks()
data := struct {
Tasks []models.Task
@@ -772,12 +767,6 @@ func (h *Handler) getAtomDetails(id, source string) (string, *time.Time) {
return "Task", nil
}
-// getAtomTitle retrieves the title for a task/card/bug from the store (legacy)
-func (h *Handler) getAtomTitle(id, source string) string {
- title, _ := h.getAtomDetails(id, source)
- return title
-}
-
// HandleUnifiedAdd creates a task in Todoist or a card in Trello from the Quick Add form
func (h *Handler) HandleUnifiedAdd(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()