This commit updates the ViewModel classes for both Chat and Task to accommodate the new structured responses received from the API. These changes are essential for the correct functioning of the application as they deal with the new TaskResponse and Step objects.
Updates in ChatViewModel:
- Modified `fetchChatsForTask` to handle structured step data
- Updated how steps are retrieved and processed
Updates in TaskViewModel:
- Updated `fetchTasks` to use the new TaskResponse object
- Refactored task fetching and selection logic
These updates ensure that the ViewModel classes are aligned with the new structured API responses, improving data handling and UI updates.
This commit includes a significant overhaul of the TaskViewModel to use the newly created TaskService and integrate it with the task API. Specifically:
- Removed dependency on mock data for tasks.
- Added real API calls through the TaskService for task operations like creating and fetching tasks.
- Updated createTask to return the ID of the newly created task.
- Updated fetchTasks method to fetch tasks from the API and update the local list.
- Updated selectTask to handle selection based on string IDs.
These changes make the TaskViewModel ready for real-world usage and remove dependencies on mock data.
This commit introduces the TaskViewModel, which manages the business logic for tasks. The ViewModel interacts with a mock data source, providing functionalities like fetching tasks, selecting a task, creating, and deleting tasks.
Additionally, comprehensive tests for TaskViewModel have been added to ensure its behavior aligns with expectations. The mock data source has also been updated to support the new functionalities.
Key Features:
- Task management in TaskViewModel.
- Tests for each major functionality in TaskViewModel.
- Mock data source to simulate data interactions.