diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-13 14:18:24 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-13 14:18:24 -1000 |
| commit | e107192be5efb65807c7da3b6aa99ce3555944d0 (patch) | |
| tree | 12f9a03a0586ec79c13b3461d960ccb27d0ae117 /issues/phase3_step4_todoist_write.md | |
| parent | 2fee76ea41f37e3a068273c05a98b892ab29228c (diff) | |
Implement Todoist write operations - API layer (Part 1)
Add CreateTask and CompleteTask methods to Todoist API client:
Models:
- Add Project struct (ID, Name) to types.go
- Add Projects []Project field to DashboardData
API Interface:
- Change GetProjects signature to return []models.Project
- Ensure CreateTask and CompleteTask are defined
Todoist Client:
- Add baseURL field for testability
- Refactor GetProjects to return []models.Project
- Update GetTasks to build project map from new GetProjects
- Implement CreateTask with JSON payload support
- Implement CompleteTask using POST to /tasks/{id}/close
Tests:
- Create comprehensive todoist_test.go
- Test CreateTask, CreateTask with due date, CompleteTask
- Test error handling and GetProjects
- Update mock client in handlers tests
All tests pass. Ready for handlers and UI integration.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'issues/phase3_step4_todoist_write.md')
| -rw-r--r-- | issues/phase3_step4_todoist_write.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/issues/phase3_step4_todoist_write.md b/issues/phase3_step4_todoist_write.md new file mode 100644 index 0000000..f68a963 --- /dev/null +++ b/issues/phase3_step4_todoist_write.md @@ -0,0 +1,40 @@ +# Phase 3 Step 4: Todoist Write Operations + +## Goal +Implement write operations for Todoist (Create Task, Complete Task) and update the UI to support them. + +## Requirements + +### Backend +1. **Models**: + * Add `Project` struct to `internal/models/types.go`. + * Add `Projects []Project` to `DashboardData`. +2. **API (`internal/api/todoist.go`)**: + * Refactor `GetProjects` to return `[]models.Project`. + * Implement `CreateTask(content, projectID string)`. + * Implement `CompleteTask(taskID string)`. + * Refactor `baseURL` to be a struct field for testability. +3. **Handlers (`internal/handlers/handlers.go`)**: + * Update `aggregateData` to fetch projects and populate `DashboardData`. + * Implement `HandleCreateTask`: + * Parse form (`content`, `project_id`). + * Call `CreateTask`. + * Return updated task list partial. + * Implement `HandleCompleteTask`: + * Call `CompleteTask`. + * Return empty string (to remove from DOM). + +### Frontend +1. **Template (`web/templates/partials/todoist-tasks.html`)**: + * Add "Quick Add" form at the top. + * Input: Task content. + * Select: Project (populated from `.Projects`). + * Update Task Items: + * Add Checkbox. + * `hx-post="/tasks/complete"`. + * `hx-target="closest .todoist-task-item"`. + * `hx-swap="outerHTML"`. + +## Verification +* Unit tests for API client. +* Manual verification of UI flows. |
