From 6a59098c3096f5ebd3a61ef5268cbd480b0f1519 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 20 Jan 2026 10:40:29 -1000 Subject: Implement efficient sync for Todoist and Trello APIs - Add Todoist Sync API v9 support with incremental sync tokens - Store sync tokens in SQLite for persistence across restarts - Add field filtering to Trello API calls to reduce payload size - Update handlers to use incremental sync (merge changes vs full replace) Co-Authored-By: Claude Opus 4.5 --- internal/handlers/handlers_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'internal/handlers/handlers_test.go') diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go index 3ea2a3e..1aa72cc 100644 --- a/internal/handlers/handlers_test.go +++ b/internal/handlers/handlers_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "task-dashboard/internal/api" "task-dashboard/internal/config" "task-dashboard/internal/models" "task-dashboard/internal/store" @@ -82,6 +83,32 @@ func (m *mockTodoistClient) CompleteTask(ctx context.Context, taskID string) err return nil } +func (m *mockTodoistClient) Sync(ctx context.Context, syncToken string) (*api.TodoistSyncResponse, error) { + if m.err != nil { + return nil, m.err + } + // Return a mock sync response with tasks converted to sync items + items := make([]api.SyncItemResponse, 0, len(m.tasks)) + for _, task := range m.tasks { + items = append(items, api.SyncItemResponse{ + ID: task.ID, + Content: task.Content, + Description: task.Description, + ProjectID: task.ProjectID, + Priority: task.Priority, + Labels: task.Labels, + IsCompleted: task.Completed, + IsDeleted: false, + }) + } + return &api.TodoistSyncResponse{ + SyncToken: "test-sync-token", + FullSync: true, + Items: items, + Projects: []api.SyncProjectResponse{}, + }, nil +} + // mockTrelloClient creates a mock Trello client for testing type mockTrelloClient struct { boards []models.Board -- cgit v1.2.3