Last Works on Webinar ...
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
using xExceptions.Attributes;
|
||||
|
||||
namespace xWebinarService.Constants {
|
||||
public class xWebinarServiceConstants { }
|
||||
|
||||
/// <summary>
|
||||
/// Webinar Type ...
|
||||
/// </summary>
|
||||
public enum XWebinarType
|
||||
{
|
||||
[StringValue("Public")]
|
||||
Public = 0,
|
||||
[StringValue("Private")]
|
||||
Private = 1
|
||||
}
|
||||
}
|
||||
+115
-1
@@ -1,3 +1,117 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Providers;
|
||||
|
||||
namespace xWebinarService.DI {
|
||||
public static class XDIHelperExtension { }
|
||||
public static class XDIHelperExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// Register Module Provided Service on DI
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="config"></param>
|
||||
public static void AddXWebinarService(
|
||||
this IServiceCollection services,
|
||||
ServiceLifetime lifeTime
|
||||
)
|
||||
{
|
||||
//
|
||||
AddWebinarService(
|
||||
services,
|
||||
lifeTime
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
/// <summary>
|
||||
/// a LogTag for XWebinarService ...
|
||||
/// </summary>
|
||||
private static string XLogTag = "XWebinarService";
|
||||
|
||||
/// <summary>
|
||||
/// print a log in Console ...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
private static void Log(string message)
|
||||
{
|
||||
Console.WriteLine($"{XLogTag} => {message}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register Push Service ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
private static void AddWebinarService(
|
||||
IServiceCollection services,
|
||||
ServiceLifetime lifeTime
|
||||
)
|
||||
{
|
||||
//
|
||||
var exception = XException.InvalidArgs.ToException(); ;
|
||||
|
||||
//
|
||||
// Services ...
|
||||
var isServicesExists = !services.IsNull();
|
||||
if (!isServicesExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, services not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Lifetime ...
|
||||
var isLifetimeExists = !lifeTime.IsNull();
|
||||
if (!isLifetimeExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, lifetime not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Check String Repository Exists ...
|
||||
var isWebinarRepositoryExists = !services
|
||||
.GetRegisteredService<IXWebinarRepository>()
|
||||
.IsNull() &&
|
||||
!services.GetRegisteredService<IXWebinarSubscriberRepository>()
|
||||
.IsNull();
|
||||
if (!isWebinarRepositoryExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, IXWebinarRepository or IXWebinarSubscriberRepository not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Check WEBRTC Hub Exists ...
|
||||
var isWebRTCHubExists = !services.GetRegisteredService<XWebinarHub>().IsNull();
|
||||
if (!isWebRTCHubExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, XWebinarHub not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Resource Providers ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarTitleResourceProvider), typeof(XWebinarTitleResourceProvider), lifeTime));
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarDescriptionResourceProvider), typeof(XWebinarDescriptionResourceProvider), lifeTime));
|
||||
|
||||
//
|
||||
// Register Main Provider ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarProvider), typeof(XWebinarProvider), lifeTime));
|
||||
|
||||
//
|
||||
Log("AddWebinarService Succeed ...");
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarDescriptionResourceProvider : IXBaseStringResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using xPushService.Base;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public abstract class XWebinarHub : XBaseWebRTCHub
|
||||
{
|
||||
protected XWebinarHub(
|
||||
IXPushGroupStore groupStore,
|
||||
IXPushConnectionStore connectionStore,
|
||||
IXWebRTCConnectionStore webRTCConnectionStore
|
||||
) : base(
|
||||
groupStore,
|
||||
connectionStore,
|
||||
webRTCConnectionStore
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarProvider
|
||||
{
|
||||
//
|
||||
#region Props ...
|
||||
IXIdentityProvider IdentityProvider { get; }
|
||||
IXWebinarRepository WebinarRepository { get; }
|
||||
XDataServiceConfiguration DataSercviceConfiguration { get; }
|
||||
IXWebinarTitleResourceProvider TitleResourceProvider { get; }
|
||||
IXWebinarSubscriberRepository WebinarSubscriberRepository { get; }
|
||||
IXWebinarDescriptionResourceProvider DescriptionResourceProvider { get; }
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tools ...
|
||||
/// <summary>
|
||||
/// Converts Specified XWebinar Entity to it's Corresponding Dto Presentation
|
||||
/// and also Fill Owner and Title/Description Resources ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> ToXWebinarDto(XWebinar model);
|
||||
|
||||
/// <summary>
|
||||
/// Converts Specified WebinarSubscriber Entity to it's Dto Presentation ...
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarSubscriberDto> ToXWebinarSubscriberDto(XWebinarSubscriber model);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
/// Create Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> CreateWebinar(XWebinarDto item);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> UpdateWebinar(XWebinarDto item);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> GetWebinar(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Webinars ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XWebinarDto>> GetWebinars();
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryWebinars(XQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveWebinar(
|
||||
Guid webinarId,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region WebinarSubscriber ...
|
||||
/// <summary>
|
||||
/// Subscribe a User to Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Subscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Check Specified User Subscribed on a Webinar or not ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsSubscribed(
|
||||
Guid webinarId,
|
||||
string subscriberId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribe Specified User from a Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Unsubscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Subscriber ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarSubscriberDto> GetSubscriber(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Specified Webinars Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
||||
Guid webinarId,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Specified Webinar's Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="requesterUserSelectByParam"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
||||
Guid webinarId,
|
||||
XQuery query,
|
||||
string requesterUserSelectByParam = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarTitleResourceProvider : IXBaseStringResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
using xWebinarService.Constants;
|
||||
|
||||
namespace xWebinarService.Models.Dtos
|
||||
{
|
||||
public class XWebinarDto : XBaseDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public XResourceDto Title { get; set; }
|
||||
public XResourceDto Description { get; set; }
|
||||
|
||||
public string OwnerId { get; set; }
|
||||
public XPersonDto Owner { get; set; }
|
||||
|
||||
public XWebinarType Type { get; set; }
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
public class XWebinarSubscriberDto : XBaseDto
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using xModels.Base;
|
||||
using xWebinarService.Constants;
|
||||
|
||||
namespace xWebinarService.Models.Entities
|
||||
{
|
||||
@@ -32,12 +33,23 @@ namespace xWebinarService.Models.Entities
|
||||
[Required]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Webinar Type ...
|
||||
/// </summary>
|
||||
public XWebinarType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creation Time ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[Required]
|
||||
public DateTime CreatedOn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specified Webinar Enabled or not ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using xCommons.Configurations;
|
||||
using xStringService.Base;
|
||||
using xStringService.Interfaces;
|
||||
using xWebinarService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// a Servide to Provides Requirements for XWebinar Description Resources ...
|
||||
/// </summary>
|
||||
public class XWebinarDescriptionResourceProvider : XBaseStringResourceProvider, IXWebinarDescriptionResourceProvider
|
||||
{
|
||||
public XWebinarDescriptionResourceProvider(
|
||||
IXStringProvider provider,
|
||||
XAppConfiguration appConfiguration
|
||||
) : base(
|
||||
"XWEBD",
|
||||
provider,
|
||||
appConfiguration
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
+988
-15
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
using xCommons.Configurations;
|
||||
using xStringService.Base;
|
||||
using xStringService.Interfaces;
|
||||
using xWebinarService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// a Servide to Provides Requirements for XWebinar Title Resources ...
|
||||
/// </summary>
|
||||
public class XWebinarTitleResourceProvider : XBaseStringResourceProvider, IXWebinarTitleResourceProvider
|
||||
{
|
||||
public XWebinarTitleResourceProvider(
|
||||
IXStringProvider provider,
|
||||
XAppConfiguration appConfiguration
|
||||
) : base(
|
||||
"XWEWBT",
|
||||
provider,
|
||||
appConfiguration
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../xDataService/xDataService.csproj" />
|
||||
<ProjectReference Include="../xPushService/xPushService.csproj" />
|
||||
<ProjectReference Include="../xStringService/xStringService.csproj" />
|
||||
<ProjectReference Include="../xIdentityService/xIdentityService.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user