summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-01-23 21:37:18 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-01-23 21:37:18 -1000
commit465093343ddd398ce5f6377fc9c472d8251c618b (patch)
treed333a2f1c8879f7b114817e929c95e9fcf5f4c3b /cmd
parente23c85577cbb0eac8b847dd989072698ff4e7a30 (diff)
Refactor: reduce code duplication with shared abstractions
- Add BaseClient HTTP abstraction (internal/api/http.go) to eliminate duplicated HTTP boilerplate across Todoist, Trello, and PlanToEat clients - Add response helpers (internal/handlers/response.go) for JSON/HTML responses - Add generic cache wrapper (internal/handlers/cache.go) using Go generics - Consolidate HandleCompleteAtom/HandleUncompleteAtom into handleAtomToggle - Merge TabsHandler into Handler, delete tabs.go - Extract sortTasksByUrgency and filterAndSortTrelloTasks helpers - Update tests to work with new BaseClient structure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dashboard/main.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go
index 050c8d0..8716db9 100644
--- a/cmd/dashboard/main.go
+++ b/cmd/dashboard/main.go
@@ -100,7 +100,6 @@ func main() {
// Initialize handlers
h := handlers.New(db, todoistClient, trelloClient, planToEatClient, googleCalendarClient, cfg)
- tabsHandler := handlers.NewTabsHandler(db, googleCalendarClient, cfg.TemplateDir)
// Set up router
r := chi.NewRouter()
@@ -133,9 +132,9 @@ func main() {
r.Get("/api/boards", h.HandleGetBoards)
// Tab routes for HTMX
- r.Get("/tabs/tasks", tabsHandler.HandleTasks)
- r.Get("/tabs/planning", tabsHandler.HandlePlanning)
- r.Get("/tabs/meals", tabsHandler.HandleMeals)
+ r.Get("/tabs/tasks", h.HandleTabTasks)
+ r.Get("/tabs/planning", h.HandleTabPlanning)
+ r.Get("/tabs/meals", h.HandleTabMeals)
r.Post("/tabs/refresh", h.HandleRefreshTab)
// Trello card operations