Implemented signalR in project infrastructure APIs

This commit is contained in:
ashutosh.nehete 2025-06-12 11:04:24 +05:30
parent f47586710b
commit 793877b8f8

View File

@ -562,7 +562,13 @@ namespace MarcoBMS.Services.Controllers
Activity = attendance.Activity,
JobRoleName = employee.JobRole.Name
};
await _signalR.Clients.All.SendAsync("Attendance", new { LoggedInUserId = currentEmployee.Id, ProjectId = recordAttendanceDot.ProjectID, Response = vm });
var sendActivity = 0;
if (recordAttendanceDot.Id == Guid.Empty)
{
sendActivity = 1;
}
var notification = new { LoggedInUserId = currentEmployee.Id, Keyword = "Attendance", Activity = sendActivity, ProjectId = attendance.ProjectID, Response = vm };
await _signalR.Clients.All.SendAsync("NotificationEventHandler", notification);
_logger.LogInfo("Attendance for employee {FirstName} {LastName} has been marked", employee.FirstName ?? string.Empty, employee.LastName ?? string.Empty);
return Ok(ApiResponse<object>.SuccessResponse(vm, "Attendance marked successfully.", 200));
}