@ -1,5 +1,5 @@
 
		
	
		
			
				import  {  sendMessage  }  from  '../utils/messaging' ;  
		
	
		
			
				import  {  createTask ,  assignTask ,  completeTask  }  from  '../../services/taskService' ;  
		
	
		
			
				import  {  createTask ,  assignTask ,  completeTask ,  getPendingTasks }  from  '../../services/taskService' ;  
		
	
		
			
				
 
		
	
		
			
				export  function  handleTaskCommand ( body : string ,  sender : string ,  groupId : string ,  linkedGroups : Set < string > )  {  
		
	
		
			
				  if  ( groupId  &&  linkedGroups . has ( groupId ) )  { 
 
		
	
	
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
				
			
			@ -35,8 +35,21 @@ export function handleTaskCommand(body: string, sender: string, groupId: string,
 
		
	
		
			
				        const  taskId  =  args [ 0 ] ; 
 
		
	
		
			
				        completeTask ( parseInt ( taskId ) ) ; 
 
		
	
		
			
				        sendMessage ( sender ,  ` Tarea  ${ taskId }  marcada como completada ` ) ; 
 
		
	
		
			
				      }  else  if  ( action  ===  'mostrar'  ||  ! action )  { 
 
		
	
		
			
				        // Handle /tarea or /tarea mostrar
 
 
		
	
		
			
				        const  user  =  ` @ ${ sender . split ( '@' ) [ 0 ] } ` ;  // Default to the sender
 
 
		
	
		
			
				        const  tasks  =  getPendingTasks ( user ) ; 
 
		
	
		
			
				
 
		
	
		
			
				        if  ( tasks . length  ===  0 )  { 
 
		
	
		
			
				          sendMessage ( sender ,  'No tienes tareas pendientes.' ) ; 
 
		
	
		
			
				        }  else  { 
 
		
	
		
			
				          const  taskList  =  tasks . map ( ( task )  = >  { 
 
		
	
		
			
				            return  ` - Tarea  ${ task . id } :  ${ task . description } ${ task . dueDate  ?  `  (para el  ${ task . dueDate } ) `  :  '' } ` ; 
 
		
	
		
			
				          } ) . join ( '\n' ) ; 
 
		
	
		
			
				          sendMessage ( sender ,  ` Tus tareas pendientes: \ n ${ taskList } ` ) ; 
 
		
	
		
			
				        } 
 
		
	
		
			
				      }  else  { 
 
		
	
		
			
				        sendMessage ( sender ,  'Acción no reconocida. Usa /tarea nueva, /tarea asignar, o /tarea completar.' ) ; 
 
		
	
		
			
				        sendMessage ( sender ,  'Acción no reconocida. Usa /tarea nueva, /tarea asignar,  /tarea completar, o /tarea mostr ar.') ; 
 
		
	
		
			
				      } 
 
		
	
		
			
				    } 
 
		
	
		
			
				  }