Load only active tasks on connect and refetch single tasks on events

This commit is contained in:
Ian Gulliver
2026-10-22 11:43:35 -07:00
parent 78fcdfff34
commit 48741e8cbb
5 changed files with 186 additions and 132 deletions
+4
View File
@@ -410,6 +410,10 @@ func (s *Store) ListTasks(ctx context.Context, projectID string) ([]api.Task, er
return s.queryTasks(ctx, `SELECT `+taskColumns+` FROM tasks WHERE project_id = ? ORDER BY created_at DESC`, projectID)
}
func (s *Store) ListActiveTasks(ctx context.Context, projectID string) ([]api.Task, error) {
return s.queryTasks(ctx, `SELECT `+taskColumns+` FROM tasks WHERE project_id = ? AND status = ? ORDER BY created_at DESC`, projectID, string(api.TaskStatusActive))
}
func (s *Store) GetTask(ctx context.Context, id string) (api.Task, error) {
t, err := scanTask(s.db.QueryRowContext(ctx, `SELECT `+taskColumns+` FROM tasks WHERE id = ?`, id))
if errors.Is(err, sql.ErrNoRows) {