Improve project-task integration and sub-task support
- TasksApi: add getSubTasks(parentId) + parentId param to create() - TasksRepository: expose new API methods - app.dart: invalidate projectsProvider + projectMilestonesProvider after quick capture creates a task; taskNew route reads ?projectId= query param and passes as initialProjectId to TaskEditScreen - project_list_screen.dart: _AddTaskRow passes projectId query param so the task editor pre-fills the project on navigation - task_edit_screen.dart: fully rewritten with initialProjectId support, sub-task fetching/creation, and _SubTasksSection widget Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@ class TasksApi {
|
||||
required TaskPriority priority,
|
||||
DateTime? dueDate,
|
||||
int? projectId,
|
||||
int? parentId,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _dio.post('/api/tasks', data: {
|
||||
@@ -43,6 +44,7 @@ class TasksApi {
|
||||
'priority': priority.value,
|
||||
'due_date': dueDate?.toIso8601String(),
|
||||
if (projectId != null) 'project_id': projectId,
|
||||
if (parentId != null) 'parent_id': parentId,
|
||||
});
|
||||
return Task.fromJson(response.data as Map<String, dynamic>);
|
||||
} on DioException catch (e) {
|
||||
@@ -50,6 +52,20 @@ class TasksApi {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Task>> getSubTasks(int parentId) async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
'/api/notes',
|
||||
queryParameters: {'parent_id': parentId, 'is_task': 'true', 'limit': 100},
|
||||
);
|
||||
final data = response.data as Map<String, dynamic>;
|
||||
final list = data['notes'] as List<dynamic>;
|
||||
return list.map((e) => Task.fromJson(e as Map<String, dynamic>)).toList();
|
||||
} on DioException catch (e) {
|
||||
throw dioToApp(e);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Task> update(int id, Map<String, dynamic> fields) async {
|
||||
try {
|
||||
final response = await _dio.put('/api/tasks/$id', data: fields);
|
||||
|
||||
Reference in New Issue
Block a user