feat(task-management): add functionality to assign tasks to specific groups

- Introduced `addTaskToGroup` action to allow tasks to be added to designated groups based on group IDs.
- Enhanced task management slice to support group assignment for better organization and compatibility with V3 API.
- Updated socket handlers to dispatch `addTaskToGroup` with appropriate group IDs extracted from backend responses.
This commit is contained in:
chamiakJ
2025-06-27 07:06:02 +05:30
parent 3d1cb29a67
commit 84f77940fd
2 changed files with 73 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ import {
} from '@/features/tasks/tasks.slice';
import {
addTask,
addTaskToGroup,
updateTask,
moveTaskToGroup,
selectCurrentGroupingV3,
@@ -355,7 +356,39 @@ export const useTaskSocketHandlers = () => {
order: data.sort_order || 0,
};
dispatch(addTask(task));
// Extract the group UUID from the backend response based on current grouping
let groupId: string | undefined;
console.log('🔍 Quick task received:', {
currentGrouping: currentGroupingV3,
status: data.status,
priority: data.priority,
phase_id: data.phase_id
});
// Select the correct UUID based on current grouping
// If currentGroupingV3 is null, default to 'status' since that's the most common grouping
const grouping = currentGroupingV3 || 'status';
console.log('📊 Using grouping:', grouping);
if (grouping === 'status') {
// For status grouping, use status field (which contains the status UUID)
groupId = data.status;
console.log('✅ Using status UUID:', groupId);
} else if (grouping === 'priority') {
// For priority grouping, use priority field (which contains the priority UUID)
groupId = data.priority;
console.log('✅ Using priority UUID:', groupId);
} else if (grouping === 'phase') {
// For phase grouping, use phase_id
groupId = data.phase_id;
console.log('✅ Using phase UUID:', groupId);
}
console.log('📤 Dispatching addTaskToGroup with:', { taskId: task.id, groupId });
// Use addTaskToGroup with the actual group UUID
dispatch(addTaskToGroup({ task, groupId }));
}
},
[dispatch]