diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-31 20:16:12 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-31 20:16:12 -1000 |
| commit | cbb0b53de1d06918c142171fd084f14f03798bc1 (patch) | |
| tree | beb642057178bce8f50e3ad67f5a62671e3e6dda /internal/api | |
| parent | d39220eac03fbc5b714bde989665ed1c92dd24a5 (diff) | |
Add feature toggles system with settings UI (#74)
- Add feature_toggles table (migration 012)
- Add source_config table for future source selection (migration 013)
- Create settings page at /settings with:
- Feature toggle management (enable/disable/create/delete)
- Data source configuration (sync and toggle boards/calendars)
- Add store methods for feature toggles and source config
- Add GetCalendarList and GetTaskLists to Google API clients
- Document feature toggle workflow in DESIGN.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/google_calendar.go | 21 | ||||
| -rw-r--r-- | internal/api/google_tasks.go | 17 | ||||
| -rw-r--r-- | internal/api/interfaces.go | 2 |
3 files changed, 40 insertions, 0 deletions
diff --git a/internal/api/google_calendar.go b/internal/api/google_calendar.go index d2d4355..68d423b 100644 --- a/internal/api/google_calendar.go +++ b/internal/api/google_calendar.go @@ -175,3 +175,24 @@ func (c *GoogleCalendarClient) GetEventsByDateRange(ctx context.Context, start, return deduplicateEvents(allEvents), nil } + +// GetCalendarList returns all calendars accessible to the user +func (c *GoogleCalendarClient) GetCalendarList(ctx context.Context) ([]models.CalendarInfo, error) { + list, err := c.srv.CalendarList.List().Do() + if err != nil { + return nil, fmt.Errorf("failed to fetch calendar list: %w", err) + } + + var calendars []models.CalendarInfo + for _, item := range list.Items { + name := item.Summary + if name == "" { + name = item.Id + } + calendars = append(calendars, models.CalendarInfo{ + ID: item.Id, + Name: name, + }) + } + return calendars, nil +} diff --git a/internal/api/google_tasks.go b/internal/api/google_tasks.go index 0b4d7c2..77a00ed 100644 --- a/internal/api/google_tasks.go +++ b/internal/api/google_tasks.go @@ -171,3 +171,20 @@ func (c *GoogleTasksClient) UncompleteTask(ctx context.Context, listID, taskID s } return nil } + +// GetTaskLists returns all task lists accessible to the user +func (c *GoogleTasksClient) GetTaskLists(ctx context.Context) ([]models.TaskListInfo, error) { + list, err := c.srv.Tasklists.List().Context(ctx).Do() + if err != nil { + return nil, fmt.Errorf("failed to fetch task lists: %v", err) + } + + var lists []models.TaskListInfo + for _, item := range list.Items { + lists = append(lists, models.TaskListInfo{ + ID: item.Id, + Name: item.Title, + }) + } + return lists, nil +} diff --git a/internal/api/interfaces.go b/internal/api/interfaces.go index aa351ab..1c102a7 100644 --- a/internal/api/interfaces.go +++ b/internal/api/interfaces.go @@ -40,6 +40,7 @@ type PlanToEatAPI interface { type GoogleCalendarAPI interface { GetUpcomingEvents(ctx context.Context, maxResults int) ([]models.CalendarEvent, error) GetEventsByDateRange(ctx context.Context, start, end time.Time) ([]models.CalendarEvent, error) + GetCalendarList(ctx context.Context) ([]models.CalendarInfo, error) } // GoogleTasksAPI defines the interface for Google Tasks operations @@ -48,6 +49,7 @@ type GoogleTasksAPI interface { GetTasksByDateRange(ctx context.Context, start, end time.Time) ([]models.GoogleTask, error) CompleteTask(ctx context.Context, listID, taskID string) error UncompleteTask(ctx context.Context, listID, taskID string) error + GetTaskLists(ctx context.Context) ([]models.TaskListInfo, error) } // Ensure concrete types implement interfaces |
