Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit c144575

Browse files
committed
feat: revert AutomationTaskSyncHandler changes and add task deleted signal dispatching
- Reverted changes in AutomationTaskSyncHandler because cross-platform sync is not used and was deemed unnecessary for now. - Added signal dispatching when a task is deleted.
1 parent b523ba9 commit c144575

2 files changed

Lines changed: 2 additions & 22 deletions

File tree

packages/core/src/lib/tasks/commands/handlers/automation-task.sync.handler.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { Task } from './../../task.entity';
2626
import { TypeOrmIntegrationMapRepository } from '../../../integration-map/repository/type-orm-integration-map.repository';
2727
import { TypeOrmTaskStatusRepository } from '../../statuses/repository/type-orm-task-status.repository';
2828
import { TypeOrmTaskRepository } from '../../repository/type-orm-task.repository';
29-
import { SocketService } from '../../../socket/socket.service';
3029

3130
@CommandHandler(AutomationTaskSyncCommand)
3231
export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTaskSyncCommand> {
@@ -38,8 +37,7 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
3837
private readonly _taskService: TaskService,
3938
private readonly activityLogService: ActivityLogService,
4039
private readonly _employeeService: EmployeeService,
41-
private readonly _entitySubscriptionService: EntitySubscriptionService,
42-
private readonly _socketService: SocketService
40+
private readonly _entitySubscriptionService: EntitySubscriptionService
4341
) {}
4442

4543
/**
@@ -189,15 +187,6 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
189187
)
190188
)
191189
);
192-
193-
// Emit tasks:changed event to all members to update their task list in the timer
194-
try {
195-
employees.forEach((employee: IEmployee) => {
196-
this._socketService.emitToClient(employee.id, 'tasks:changed', null);
197-
});
198-
} catch (error) {
199-
console.error(`Error while sending tasks:changed event to members: ${error}`);
200-
}
201190
} catch (error) {
202191
console.error('Error subscribing new members to the task:', error);
203192
}
@@ -313,16 +302,6 @@ export class AutomationTaskSyncHandler implements ICommandHandler<AutomationTask
313302
}
314303
}
315304

316-
// Emit tasks:changed event to all existing members as well
317-
try {
318-
const allMemberIds = new Set([...existingMemberIds, ...memberIds]);
319-
allMemberIds.forEach((memberId) => {
320-
this._socketService.emitToClient(memberId, 'tasks:changed', null);
321-
});
322-
} catch (error) {
323-
console.error(`Error while sending tasks:changed event to all members: ${error}`);
324-
}
325-
326305
// Activity Log Task Update
327306
this.activityLogService.logActivity<Task>(
328307
BaseEntityEnum.Task,

packages/core/src/lib/tasks/task.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@ export class TaskService extends TenantAwareCrudService<Task> {
14201420
// Send a real-time event to the specified user via socket.
14211421
// No error is thrown if the user is not currently connected.
14221422
this._socketService.sendTimerChanged(employeeId);
1423+
this._socketService.emitToClient(employeeId, 'tasks:changed', null);
14231424
}
14241425

14251426
return result;

0 commit comments

Comments
 (0)