diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-26 16:49:44 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-26 16:49:44 -1000 |
| commit | 42a4e32daca13b518e64e5821080ff3d6adf0e39 (patch) | |
| tree | 639c790e25b961ecf51ab6ea75206bc3432f1548 /issues/phase4_step2_efficient_sync.md | |
| parent | 8de1b5cb8915ed9a6e32566431d05fafafeb338d (diff) | |
Use configured timezone throughout codebase
- Add config/timezone.go with timezone utilities:
- SetDisplayTimezone(), GetDisplayTimezone()
- Now(), Today() - current time/date in display TZ
- ParseDateInDisplayTZ(), ToDisplayTZ() - parsing helpers
- Initialize timezone at startup in main.go
- Update all datetime logic to use configured timezone:
- handlers/handlers.go - all time.Now() calls
- handlers/timeline.go - date parsing
- handlers/timeline_logic.go - now calculation
- models/atom.go - ComputeUIFields()
- models/timeline.go - ComputeDaySection()
- api/plantoeat.go - meal date parsing
- api/todoist.go - due date parsing
- api/trello.go - due date parsing
This ensures all dates/times display correctly regardless
of server timezone setting.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'issues/phase4_step2_efficient_sync.md')
| -rw-r--r-- | issues/phase4_step2_efficient_sync.md | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/issues/phase4_step2_efficient_sync.md b/issues/phase4_step2_efficient_sync.md deleted file mode 100644 index 92fa03c..0000000 --- a/issues/phase4_step2_efficient_sync.md +++ /dev/null @@ -1,46 +0,0 @@ -# Phase 4 Step 2: Efficient Sync Research & Implementation - -## Status: COMPLETE - -## Goal -Improve the efficiency of data synchronization to reduce API calls and latency. Previously, the dashboard fetched all data on every refresh. - -## Implementation - -### Todoist Sync API v9 -- **Endpoint**: `https://api.todoist.com/sync/v9/sync` -- **Method**: POST with `sync_token` and `resource_types` -- **Full sync**: When token is `*` or empty, returns all items -- **Incremental sync**: With valid token, returns only changes since last sync -- **Response**: Contains `sync_token` (for next request), `full_sync` flag, `items`, `projects` - -### Storage -- New `sync_tokens` table in SQLite for persisting tokens across restarts -- Store methods: `GetSyncToken()`, `SetSyncToken()`, `ClearSyncToken()` -- Incremental update methods: `UpsertTask()`, `DeleteTasksByIDs()` - -### Handler Logic -- `fetchTasks()` uses Sync API with stored token -- If `FullSync=true`: Replace all cached tasks -- If `FullSync=false`: Merge changes (upsert active, delete completed/deleted) -- Falls back to cached data on API errors - -### Trello Optimization -- Added `fields` parameter to API calls to reduce response payload: - - `GetBoards()`: `fields=id,name` - - `GetCards()`: `fields=id,name,idList,due,url,idBoard` - - `getLists()`: `fields=id,name` - -## Files Modified -- `migrations/003_add_sync_tokens.sql` (new) -- `internal/store/sqlite.go` - Added sync token and incremental update methods -- `internal/api/todoist.go` - Added Sync API support -- `internal/api/interfaces.go` - Added Sync method to interface -- `internal/api/trello.go` - Added field filtering -- `internal/handlers/handlers.go` - Updated fetchTasks to use Sync API -- `internal/handlers/handlers_test.go` - Updated mock to implement Sync - -## Benefits -- **Todoist**: Reduced data transfer on subsequent syncs (only changes returned) -- **Trello**: Smaller API responses (only required fields) -- **Persistence**: Sync token survives restarts, enabling incremental sync on startup |
