Add Webinar ID Support for Viewer Join and Leave ...

This commit is contained in:
2025-11-16 09:46:46 +03:30
parent 5b23542008
commit 95c1536924
2 changed files with 27 additions and 11 deletions
+10 -4
View File
@@ -12,7 +12,7 @@ using xPushService.Base;
using xPushService.Extensions; using xPushService.Extensions;
using xWebinarService.Constants; using xWebinarService.Constants;
using xWebinarService.Models.Dtos; using xWebinarService.Models.Dtos;
using xWebinarService.Providers; using xWebinarService.Interfaces;
namespace xWebinarService.Hub namespace xWebinarService.Hub
{ {
@@ -20,14 +20,14 @@ namespace xWebinarService.Hub
{ {
// //
#region Props ... #region Props ...
public readonly XWebinarProvider webinarProvider; public readonly IXWebinarProvider webinarProvider;
#endregion #endregion
// //
#region Constructor ... #region Constructor ...
public XWebinarHub( public XWebinarHub(
ILogger<XWebinarHub> logger, ILogger<XWebinarHub> logger,
XWebinarProvider webinarProvider IXWebinarProvider webinarProvider
) : base(logger) ) : base(logger)
{ {
this.webinarProvider = webinarProvider; this.webinarProvider = webinarProvider;
@@ -260,7 +260,12 @@ namespace xWebinarService.Hub
// //
// Notify Other Users which a Viewer Joined ... // Notify Other Users which a Viewer Joined ...
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerJoined.GetStringValue(), connectionId, userInfo.UserId, userInfo.UserName); await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerJoined.GetStringValue(),
connectionId,
webinarId,
userInfo.UserId,
userInfo.UserName
);
} }
catch catch
{ } { }
@@ -341,6 +346,7 @@ namespace xWebinarService.Hub
// Notify Other Users which a Viewer Leaved ... // Notify Other Users which a Viewer Leaved ...
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerLeaved.GetStringValue(), await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerLeaved.GetStringValue(),
connectionId, connectionId,
webinarId,
userInfo.UserId, userInfo.UserId,
userInfo.UserName userInfo.UserName
); );
+10
View File
@@ -84,6 +84,7 @@ namespace xWebinarService.Providers
Id = model.Id, Id = model.Id,
Type = model.Type, Type = model.Type,
OwnerId = model.OwnerId, OwnerId = model.OwnerId,
Enabled = model.Enabled,
CreatedOn = model.CreatedOn, CreatedOn = model.CreatedOn,
// //
@@ -335,6 +336,15 @@ namespace xWebinarService.Providers
entity = await WebinarRepository.UpdateAsync(entity.Id, entity); entity = await WebinarRepository.UpdateAsync(entity.Id, entity);
} }
//
// Check if Enabled Change Update it ...
if (entity.Enabled != item.Enabled)
{
//
entity.Enabled = item.Enabled;
entity = await WebinarRepository.UpdateAsync(entity.Id, entity);
}
// //
// Retrieve Entity Dto ... // Retrieve Entity Dto ...
var entityDto = await ToXWebinarDto(entity); var entityDto = await ToXWebinarDto(entity);