From 8dbb6f43577b8a86e94ef7aaee196f9743356643 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sun, 18 Jan 2026 15:24:58 -1000 Subject: Implement unified task completion with cache sync (Phase 3 Step 7) Add checkbox UI to Tasks tab for completing Todoist tasks and archiving Trello cards. Fix cache synchronization so completed items stay gone after page reload by deleting them from SQLite cache after API success. - Add HandleCompleteAtom handler routing to Todoist/Trello APIs - Add DeleteTask/DeleteCard store methods for cache removal - Add htmx.process() calls after innerHTML updates in app.js - Add comprehensive tests for completion and cache behavior Co-Authored-By: Claude Opus 4.5 --- internal/store/sqlite.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'internal/store/sqlite.go') diff --git a/internal/store/sqlite.go b/internal/store/sqlite.go index c97d0af..79f5cc8 100644 --- a/internal/store/sqlite.go +++ b/internal/store/sqlite.go @@ -167,6 +167,12 @@ func (s *Store) GetTasks() ([]models.Task, error) { return tasks, rows.Err() } +// DeleteTask removes a task from the cache by ID +func (s *Store) DeleteTask(id string) error { + _, err := s.db.Exec(`DELETE FROM tasks WHERE id = ?`, id) + return err +} + // Notes operations // SaveNotes saves multiple notes to the database @@ -403,6 +409,12 @@ func (s *Store) IsCacheValid(key string) (bool, error) { return cm.IsCacheValid(), nil } +// InvalidateCache removes the cache metadata for a given key, forcing a refresh on next fetch +func (s *Store) InvalidateCache(key string) error { + _, err := s.db.Exec(`DELETE FROM cache_metadata WHERE key = ?`, key) + return err +} + // Boards operations // SaveBoards saves multiple boards to the database @@ -538,3 +550,9 @@ func (s *Store) GetBoards() ([]models.Board, error) { return boards, cardRows.Err() } + +// DeleteCard removes a card from the cache by ID +func (s *Store) DeleteCard(id string) error { + _, err := s.db.Exec(`DELETE FROM cards WHERE id = ?`, id) + return err +} -- cgit v1.2.3