feat: implement SignalR notifications for project status changes
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using GozareshgirProgramManager.Application.Interfaces;
|
||||
using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using ServiceHost.Hubs.ProgramManager;
|
||||
|
||||
namespace ServiceHost.Notifications.ProgramManager;
|
||||
|
||||
public class SignalRBoardNotificationPublisher:IBoardNotificationPublisher
|
||||
{
|
||||
private readonly IHubContext<ProjectBoardHub> _hubContext;
|
||||
|
||||
public SignalRBoardNotificationPublisher(IHubContext<ProjectBoardHub> hubContext)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
}
|
||||
|
||||
public Task SendProjectStatusChanged(long userId, TaskSectionStatus oldStatus,
|
||||
TaskSectionStatus newStatus, Guid sectionId)
|
||||
{
|
||||
var payload = new
|
||||
{
|
||||
UserId = userId,
|
||||
OldStatus = oldStatus,
|
||||
NewStatus = newStatus,
|
||||
SectionId = sectionId
|
||||
};
|
||||
_hubContext.Clients.User(userId.ToString()).SendAsync("ReceiveProjectStatusChanged",payload);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user