Compare commits
10
Commits
ba74efaf3c
...
00b2819130
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00b2819130 | ||
|
|
c4a60f655d | ||
|
|
b582b5c73a | ||
|
|
d2d3ac90b6 | ||
|
|
cf6568e089 | ||
|
|
70591a854a | ||
|
|
4cd46dba8f | ||
|
|
d5498d9f6f | ||
|
|
8c9d688fd8 | ||
|
|
29a804b018 |
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Configurations.Entities
|
||||
{
|
||||
public class XWebinarEntityConfiguration : XBaseEntityTypeConfiguration<XWebinar, Guid>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<XWebinar> builder)
|
||||
{
|
||||
builder.ToTable(XWebinarServiceConstants.XWebinarTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Configurations.Entities
|
||||
{
|
||||
public class XWebinarSubscriberEntityConfiguration : XBaseEntityTypeConfiguration<XWebinarSubscriber, int>
|
||||
{
|
||||
public override void Configure(EntityTypeBuilder<XWebinarSubscriber> builder)
|
||||
{
|
||||
builder.ToTable(XWebinarServiceConstants.XWebinarSubscriberTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using xExceptions.Attributes;
|
||||
|
||||
namespace xWebinarService.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Webinar Connection Hub Actions ...
|
||||
/// </summary>
|
||||
public enum XWebinarHubAction
|
||||
{
|
||||
/// <summary>
|
||||
/// When a Webinar is Available to Join ...
|
||||
/// </summary>
|
||||
[StringValue("WebinarOpened")]
|
||||
WebinarOpened,
|
||||
|
||||
/// <summary>
|
||||
/// When a Webinar Closed ...
|
||||
/// </summary>
|
||||
[StringValue("WebinarClosed")]
|
||||
WebinarClosed,
|
||||
|
||||
/// <summary>
|
||||
/// When a Viewer is Joined to Webinar ...
|
||||
/// </summary>
|
||||
[StringValue("ViewerJoined")]
|
||||
ViewerJoined,
|
||||
|
||||
/// <summary>
|
||||
/// When a Webinar Subscriber Leaved a Webinar ...
|
||||
/// </summary>
|
||||
[StringValue("ViewerLeaved")]
|
||||
ViewerLeaved,
|
||||
|
||||
/// <summary>
|
||||
/// Send a Message to Webinar ...
|
||||
/// </summary>
|
||||
[StringValue("Message")]
|
||||
Message,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entity Hub Actions ...
|
||||
/// </summary>
|
||||
public enum XWebinarEntityHubAction
|
||||
{
|
||||
[StringValue("Subscribe")]
|
||||
Subscribe,
|
||||
[StringValue("Unsubscribe")]
|
||||
Unsubscribe
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace xWebinarService.Constants
|
||||
{
|
||||
public struct XWebinarServiceConstants
|
||||
{
|
||||
//
|
||||
// Service Extensions Log Tag ...
|
||||
public const string XWebinarServiceDILogTag = "XWebinarService";
|
||||
|
||||
//
|
||||
// Table Mapping Identifiers ...
|
||||
public const string XWebinarTable = "Webinars";
|
||||
public const string XWebinarSubscriberTable = "WebinarSubscribers";
|
||||
|
||||
//
|
||||
// GraphQL Collection Mappings ...
|
||||
public const string XWebinarSingleName = "webinar";
|
||||
public const string XWebinarCollectionName = "webinars";
|
||||
|
||||
public const string XWebinarSubscriberSingleName = "webinarSubscriber";
|
||||
public const string XWebinarSubscriberCollectionName = "webinarSubscribers";
|
||||
|
||||
//
|
||||
// Hubs ...
|
||||
public const string XWebinarDtoHub = "webinarDto";
|
||||
public const string XWebinarEntityHub = "webinarEntity";
|
||||
public const string XWebinarSubscriberDtoHub = "webinarSubscriberDto";
|
||||
public const string XWebinarSubscriberEntityHub = "webinarSubscriberEntity";
|
||||
|
||||
//
|
||||
// Custome Constants ...
|
||||
|
||||
//
|
||||
// EF Repositories Helper Extensions ...
|
||||
public const string GetXWebinarEFRepositoryDescriptor = "GetXWebinarEFRepositoryDescriptor";
|
||||
public const string GetXWebinarSubscriberEFRepositoryDescriptor = "GetXWebinarSubscriberEFRepositoryDescriptor";
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
using xExceptions.Attributes;
|
||||
|
||||
namespace xWebinarService.Constants {
|
||||
public class xWebinarServiceConstants { }
|
||||
|
||||
namespace xWebinarService.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Webinar Type ...
|
||||
/// </summary>
|
||||
File diff suppressed because it is too large
Load Diff
+180
-49
@@ -1,15 +1,21 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xCommons.Extensions;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xCommons.Helpers;
|
||||
using xDataService.Constants;
|
||||
using xDataService.Db;
|
||||
using xDataService.DI;
|
||||
using xDataService.Models;
|
||||
using xExceptions.Constants;
|
||||
using xFileService.Interfaces;
|
||||
using xTagService.Interfaces;
|
||||
using xWebinarService.Interfaces;
|
||||
using xPushService.DI;
|
||||
using xPushService.Helpers;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Helpers;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
using xWebinarService.Providers;
|
||||
using xWebinarService.Providers.Dtos;
|
||||
using xWebinarService.Providers.Entities;
|
||||
|
||||
namespace xWebinarService.DI
|
||||
{
|
||||
@@ -19,25 +25,103 @@ namespace xWebinarService.DI
|
||||
/// Register Service ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="repositoryType"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
public static void AddXWebinarService(
|
||||
this IServiceCollection services,
|
||||
ServiceLifetime lifeTime
|
||||
XRepositoryType repositoryType,
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||
)
|
||||
{
|
||||
AddWebinarService(
|
||||
contextType: null,
|
||||
services: services,
|
||||
lifeTime: lifeTime,
|
||||
repositoryType: repositoryType
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Register Service ...
|
||||
/// </summary>
|
||||
/// <typeparam name="TContext"></typeparam>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="repositoryType"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
public static void AddXWebinarService<TContext>(
|
||||
this IServiceCollection services,
|
||||
XRepositoryType repositoryType,
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||
)
|
||||
where TContext : XDbContext
|
||||
{
|
||||
AddWebinarService(
|
||||
services: services,
|
||||
lifeTime: lifeTime,
|
||||
contextType: typeof(TContext),
|
||||
repositoryType: repositoryType
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use XWebinarService Middleware ...
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="isDevelopmentEnvironment"></param>
|
||||
public static void UsexWebinarService(
|
||||
this IApplicationBuilder app,
|
||||
bool isDevelopmentEnvironment = false
|
||||
)
|
||||
{
|
||||
//
|
||||
AddWebinarService(
|
||||
services,
|
||||
lifeTime
|
||||
);
|
||||
#region Using XWebinar Hubs ...
|
||||
//
|
||||
var pushHelper = new XPushServiceHelper();
|
||||
|
||||
//
|
||||
pushHelper.AddHub<XWebinarDtoHub>(XWebinarServiceConstants.XWebinarDtoHub);
|
||||
pushHelper.AddHub<XWebinarEntityHub>(XWebinarServiceConstants.XWebinarEntityHub);
|
||||
|
||||
//
|
||||
pushHelper.AddHub<XWebinarSubscriberDtoHub>(XWebinarServiceConstants.XWebinarSubscriberDtoHub);
|
||||
pushHelper.AddHub<XWebinarSubscriberEntityHub>(XWebinarServiceConstants.XWebinarSubscriberEntityHub);
|
||||
|
||||
//
|
||||
app.UseXPushService(pushHelper);
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Using XWebinar Repository Descriptor ...
|
||||
if (!webinarDescriptor.IsNull())
|
||||
{
|
||||
//
|
||||
app.UseXRepository(
|
||||
descriptor: webinarDescriptor,
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Using XWebinarSubscriber Repository Descriptor ...
|
||||
if (!webinarSubscriberDescriptor.IsNull())
|
||||
{
|
||||
//
|
||||
app.UseXRepository(
|
||||
descriptor: webinarSubscriberDescriptor,
|
||||
isDevelopmentEnvironment: isDevelopmentEnvironment
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
#region Private ...
|
||||
private static XRepositoryDescriptor webinarDescriptor = null;
|
||||
private static XRepositoryDescriptor webinarSubscriberDescriptor = null;
|
||||
|
||||
/// <summary>
|
||||
/// a LogTag for Service ...
|
||||
/// </summary>
|
||||
private static string XLogTag = "XWebinarService";
|
||||
private static string XLogTag = XWebinarServiceConstants.XWebinarServiceDILogTag;
|
||||
|
||||
/// <summary>
|
||||
/// print a log in Console ...
|
||||
@@ -52,10 +136,14 @@ namespace xWebinarService.DI
|
||||
/// Register Service ...
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="repositoryType"></param>
|
||||
/// <param name="contextType"></param>
|
||||
/// <param name="lifeTime"></param>
|
||||
private static void AddWebinarService(
|
||||
IServiceCollection services,
|
||||
ServiceLifetime lifeTime
|
||||
XRepositoryType repositoryType,
|
||||
Type contextType = null,
|
||||
ServiceLifetime lifeTime = ServiceLifetime.Scoped
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -67,7 +155,7 @@ namespace xWebinarService.DI
|
||||
if (!isServicesExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, services not provided ...");
|
||||
Log("Service Registration failed, services not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@@ -77,60 +165,103 @@ namespace xWebinarService.DI
|
||||
if (!isLifetimeExists)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, lifetime not provided ...");
|
||||
Log("Service Registration failed, lifetime not provided ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Dependencies Exists ...
|
||||
var isDependenciesPassed = !services
|
||||
.GetRegisteredService<IXWebinarSubscriberRepository>()
|
||||
.IsNull() &&
|
||||
!services.GetRegisteredService<IXTagProvider>().IsNull() &&
|
||||
!services.GetRegisteredService<IXFileProvider>().IsNull();
|
||||
if (!isDependenciesPassed)
|
||||
// Validate Repository Type ...
|
||||
var isRepositoryTypeValid =
|
||||
(repositoryType == XRepositoryType.EF &&
|
||||
!contextType.IsNull()) ||
|
||||
((repositoryType == XRepositoryType.Mongo ||
|
||||
repositoryType == XRepositoryType.InMemory) &&
|
||||
contextType.IsNull());
|
||||
if (!isRepositoryTypeValid)
|
||||
{
|
||||
//
|
||||
Log("AddFileService failed due Dependencies Issues, IXTagProvider, IXFileProvider, IXWebinarSubscriberRepository not provided ...");
|
||||
Log("Service Registration failed, Invalid Repository Type and Context Type ...");
|
||||
throw exception;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Repository Exists ...
|
||||
var isRepositoryExists = !services
|
||||
.GetRegisteredService<IXWebinarRepository>()
|
||||
.IsNull();
|
||||
if (!isRepositoryExists)
|
||||
// Maske Instance of Repository Descriptor
|
||||
// Based on Provided Type ...
|
||||
switch (repositoryType)
|
||||
{
|
||||
//
|
||||
Log("AddWebinarService failed, IXWebinarRepository not provided ...");
|
||||
throw exception;
|
||||
case XRepositoryType.EF:
|
||||
//
|
||||
webinarDescriptor = typeof(XWebinarServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
args: null,
|
||||
runtimeType: contextType,
|
||||
methodName: XWebinarServiceConstants.GetXWebinarEFRepositoryDescriptor
|
||||
);
|
||||
|
||||
//
|
||||
webinarSubscriberDescriptor = typeof(XWebinarServiceHelper)
|
||||
.InvokeGenericMethod<XRepositoryDescriptor>(
|
||||
args: null,
|
||||
runtimeType: contextType,
|
||||
methodName: XWebinarServiceConstants.GetXWebinarSubscriberEFRepositoryDescriptor
|
||||
);
|
||||
break;
|
||||
|
||||
//
|
||||
case XRepositoryType.Mongo:
|
||||
webinarDescriptor = XWebinarServiceHelper.GetXWebinarMongoRepositoryDescriptor();
|
||||
webinarSubscriberDescriptor = XWebinarServiceHelper.GetXWebinarSubscriberMongoRepositoryDescriptor();
|
||||
break;
|
||||
|
||||
//
|
||||
case XRepositoryType.InMemory:
|
||||
webinarDescriptor = XWebinarServiceHelper.GetXWebinarInMemoryRepositoryDescriptor();
|
||||
webinarSubscriberDescriptor = XWebinarServiceHelper.GetXWebinarSubscriberInMemoryRepositoryDescriptor();
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Webinar Group In Memory Repository ...
|
||||
services.AddSingleton<IXKeyGenerator<XWebinarGroupEntity, Guid>, XGuidKeyGenerator<XWebinarGroupEntity>>();
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarGroupStore), typeof(XWebinarGroupStore), ServiceLifetime.Singleton));
|
||||
// Register xWebinar Repository Descriptor ...
|
||||
services.AddXRepository(
|
||||
lifeTime: lifeTime,
|
||||
descriptor: webinarDescriptor
|
||||
);
|
||||
|
||||
services.AddXRepository(
|
||||
lifeTime: lifeTime,
|
||||
descriptor: webinarSubscriberDescriptor
|
||||
);
|
||||
|
||||
//
|
||||
// Register Resource Providers ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarTitleResourceProvider), typeof(XWebinarTitleResourceProvider), lifeTime));
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarDescriptionResourceProvider), typeof(XWebinarDescriptionResourceProvider), lifeTime));
|
||||
// Register Dto Services ...
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarServiceProvider), typeof(XWebinarServiceProvider), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarRepositoryService), typeof(XWebinarRepositoryService), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarRepositoryProvider), typeof(XWebinarRepositoryProvider), lifeTime)
|
||||
);
|
||||
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarSubscriberServiceProvider), typeof(XWebinarSubscriberServiceProvider), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarSubscriberRepositoryService), typeof(XWebinarSubscriberRepositoryService), lifeTime)
|
||||
);
|
||||
services.Add(
|
||||
new ServiceDescriptor(typeof(IXWebinarSubscriberRepositoryProvider), typeof(XWebinarSubscriberRepositoryProvider), lifeTime)
|
||||
);
|
||||
|
||||
//
|
||||
// Register Webinar Tag Provider ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarTagProvider), typeof(XWebinarTagProvider), lifeTime));
|
||||
// services.Add(
|
||||
// new ServiceDescriptor(typeof(IXWebinarProvider), typeof(XWebinarProvider), lifeTime)
|
||||
// );
|
||||
|
||||
//
|
||||
// Register Webinar File Provider ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarFileProvider), typeof(XWebinarFileProvider), lifeTime));
|
||||
|
||||
//
|
||||
// Register Main Provider ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXWebinarProvider), typeof(XWebinarProvider), lifeTime));
|
||||
|
||||
//
|
||||
Log("AddWebinarService Succeed ...");
|
||||
Log("Service Regitration Succeed ...");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using xDataService.Events;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.Events
|
||||
{
|
||||
public class XWebinarEvents : XBaseRepositoryEvents<XWebinar>, IXWebinarEvents
|
||||
{ }
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using xDataService.Events;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.Events
|
||||
{
|
||||
public class XWebinarSubscriberEvents : XBaseRepositoryEvents<XWebinarSubscriber>, IXWebinarSubscriberEvents
|
||||
{ }
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
namespace xWebinarService.Extensions {
|
||||
public static class xWebinarServiceExtensions { }
|
||||
}
|
||||
@@ -0,0 +1,550 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
using xDataService.Db;
|
||||
using xDataService.Models;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
using xWebinarService.Providers.Entities;
|
||||
using xWebinarService.Providers.GraphQL;
|
||||
|
||||
namespace xWebinarService.Helpers
|
||||
{
|
||||
public static class XWebinarServiceHelper
|
||||
{
|
||||
//
|
||||
#region XWebinar ...
|
||||
//
|
||||
#region EF Repository Descriptor Provider(s) ...
|
||||
public static XEFRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarEFRepository<TContext>,
|
||||
TContext
|
||||
> GetXWebinarEFRepositoryDescriptor<TContext>()
|
||||
where TContext : XDbContext
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarEFRepository<TContext>,
|
||||
TContext
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XEFRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarEFRepository<TContext>,
|
||||
TContext,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
||||
where TContext : XDbContext
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarEFRepository<TContext>,
|
||||
TContext,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Mongo Repository Descriptor Provider(s) ...
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarMongoRepository
|
||||
> GetXWebinarMongoRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarMongoRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarMongoRepository,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarMongoRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarMongoRepository,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region InMemory Repository Descriptor Provider(s) ...
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarInMemoryRepository
|
||||
> GetXWebinarInMemoryRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarInMemoryRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarInMemoryRepository,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarInMemoryRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinar, Guid>
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XWebinar,
|
||||
Guid,
|
||||
IXWebinarKeyGenerator,
|
||||
XWebinarKeyGenerator,
|
||||
IXWebinarRepositoryEvents,
|
||||
XWebinarRepositoryEvents,
|
||||
XWebinarGraphType,
|
||||
GuidGraphType,
|
||||
XWebinarGraphQuery,
|
||||
IXWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphQLTypeHelper,
|
||||
XWebinarGraphSchema,
|
||||
IXWebinarRepository,
|
||||
XWebinarInMemoryRepository,
|
||||
IXWebinarSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region XWebinarSubscriber ...
|
||||
//
|
||||
#region EF Repository Descriptor Provider(s) ...
|
||||
public static XEFRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberEFRepository<TContext>,
|
||||
TContext
|
||||
> GetXWebinarSubscriberEFRepositoryDescriptor<TContext>()
|
||||
where TContext : XDbContext
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberEFRepository<TContext>,
|
||||
TContext
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XEFRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberEFRepository<TContext>,
|
||||
TContext,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarSubscriberEFRepositoryDescriptor<TContext, TSeederImplementation>()
|
||||
where TContext : XDbContext
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
||||
{
|
||||
//
|
||||
var result = new XEFRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberEFRepository<TContext>,
|
||||
TContext,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Mongo Repository Descriptor Provider(s) ...
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberMongoRepository
|
||||
> GetXWebinarSubscriberMongoRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberMongoRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XMongoRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberMongoRepository,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarSubscriberMongoRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
||||
{
|
||||
//
|
||||
var result = new XMongoRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberMongoRepository,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region InMemory Repository Descriptor Provider(s) ...
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberInMemoryRepository
|
||||
> GetXWebinarSubscriberInMemoryRepositoryDescriptor()
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberInMemoryRepository
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public static XInMemoryRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberInMemoryRepository,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
> GetXWebinarSubscriberInMemoryRepositoryDescriptor<TSeederImplementation>()
|
||||
where TSeederImplementation : XBaseDbSeeder<XWebinarSubscriber, int>
|
||||
{
|
||||
//
|
||||
var result = new XInMemoryRepositoryDescriptor<
|
||||
XWebinarSubscriber,
|
||||
int,
|
||||
IXWebinarSubscriberKeyGenerator,
|
||||
XWebinarSubscriberKeyGenerator,
|
||||
IXWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberRepositoryEvents,
|
||||
XWebinarSubscriberGraphType,
|
||||
IntGraphType,
|
||||
XWebinarSubscriberGraphQuery,
|
||||
IXWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphQLTypeHelper,
|
||||
XWebinarSubscriberGraphSchema,
|
||||
IXWebinarSubscriberRepository,
|
||||
XWebinarSubscriberInMemoryRepository,
|
||||
IXWebinarSubscriberSeeder,
|
||||
TSeederImplementation
|
||||
>();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Hubs
|
||||
{
|
||||
public class XWebinarEntityHub : XBaseEntityHub<XWebinar, Guid>
|
||||
{
|
||||
//
|
||||
#region Constructor ...
|
||||
public XWebinarEntityHub(ILogger<XBaseHub> logger) : base(logger)
|
||||
{ }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,562 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xCommons.Extensions;
|
||||
using xExceptions.Constants;
|
||||
using xPushService.Base;
|
||||
using xPushService.Extensions;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Hubs
|
||||
{
|
||||
public class XWebinarHub : XBaseWebRTCHub
|
||||
{
|
||||
//
|
||||
#region Props ...
|
||||
public readonly IXWebinarProvider webinarProvider;
|
||||
private readonly IXWebinarGroupStore webinarGroupStore;
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Constructor ...
|
||||
public XWebinarHub(
|
||||
ILogger<XWebinarHub> logger,
|
||||
IXWebinarProvider webinarProvider,
|
||||
IXWebinarGroupStore webinarGroupStore
|
||||
) : base(logger)
|
||||
{
|
||||
this.webinarProvider = webinarProvider;
|
||||
this.webinarGroupStore = webinarGroupStore;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
/// a Webinar Owner Open Webinar for Broadcasting ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task WebinarOpened(Guid webinarId)
|
||||
{
|
||||
//
|
||||
// Validate Arg ...
|
||||
var isValid = !webinarId.IsNull() &&
|
||||
!webinarId.IsDefaultGuid();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invalid Webinar Provider ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Reading and Validate Requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
isValid = !userInfo.IsNullOrDefault() &&
|
||||
!connectionId.IsNullOrEmpty();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invaid User Info ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Webinar Model and Validate it Exists ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve Webinar ...
|
||||
var webinar = await webinarProvider.GetWebinar(webinarId);
|
||||
|
||||
//
|
||||
// Validate Webinar ...
|
||||
isValid = !webinar.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
XException.NotFound.Throw();
|
||||
logger.LogError($"Webinar Not Found ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Validate User is Webinar Owner ...
|
||||
isValid =
|
||||
!userInfo.UserId.IsNullOrEmpty() &&
|
||||
userInfo.UserId == webinar.OwnerId;
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
XException.NotAllowed.Throw();
|
||||
logger.LogError($"Not Allowed to Present Webinar ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Now try to Enable Webinar and Notify Webinars Client Which it's Open ...
|
||||
webinar.Enabled = true;
|
||||
webinar = await webinarProvider.UpdateWebinar(webinar);
|
||||
await Clients.AllExcept(connectionId).SendAsync(XWebinarHubAction.WebinarOpened.GetStringValue(), webinarId);
|
||||
|
||||
//
|
||||
// Create a Group and Put User on it ...
|
||||
await Groups.AddToGroupAsync(connectionId, webinarId.ToString());
|
||||
|
||||
//
|
||||
// Check Exists or not ...
|
||||
var connection = new XHubConnectionDto
|
||||
{
|
||||
UserId = userInfo.UserId,
|
||||
ConnectionId = connectionId,
|
||||
Username = userInfo.UserName,
|
||||
};
|
||||
var groupEntity = await webinarGroupStore.FindOneAsync(x => x.WebinarId == webinarId);
|
||||
if (!groupEntity.IsNullOrDefault())
|
||||
{
|
||||
//
|
||||
// Update ...
|
||||
groupEntity.Connections.Clear();
|
||||
groupEntity.Connections.Add(connection);
|
||||
await webinarGroupStore.UpdateAsync(groupEntity.Id, groupEntity);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Add ...
|
||||
groupEntity = new XWebinarGroupEntity
|
||||
{
|
||||
WebinarId = webinarId
|
||||
};
|
||||
groupEntity.Connections.Add(connection);
|
||||
await webinarGroupStore.AddAsync(groupEntity);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close a Webinar by it's Owner ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task WebinarClosed(Guid webinarId)
|
||||
{
|
||||
//
|
||||
// Validate Arg ...
|
||||
var isValid = !webinarId.IsNull() &&
|
||||
!webinarId.IsDefaultGuid();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invalid Webinar Provider ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Reading and Validate Requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
isValid = !userInfo.IsNullOrDefault() &&
|
||||
!connectionId.IsNullOrEmpty();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invaid User Info ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve Webinar Model and Validate it Exists ...
|
||||
try
|
||||
{
|
||||
//
|
||||
// Retrieve Webinar ...
|
||||
var webinar = await webinarProvider.GetWebinar(webinarId);
|
||||
|
||||
//
|
||||
// Validate Webinar ...
|
||||
isValid = !webinar.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
XException.NotFound.Throw();
|
||||
logger.LogError($"Webinar Not Found ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Validate User is Webinar Owner ...
|
||||
isValid =
|
||||
!userInfo.UserId.IsNullOrEmpty() &&
|
||||
userInfo.UserId == webinar.OwnerId;
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
XException.NotAllowed.Throw();
|
||||
logger.LogError($"Not Allowed to Present Webinar ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Now try to Enable Webinar and Notify Webinars Client Which it's Open ...
|
||||
webinar.Enabled = false;
|
||||
webinar = await webinarProvider.UpdateWebinar(webinar);
|
||||
await Clients.AllExcept(connectionId).SendAsync(XWebinarHubAction.WebinarClosed.GetStringValue(), webinarId);
|
||||
|
||||
//
|
||||
var webinarName = webinarId.ToString();
|
||||
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.WebinarClosed.ToString());
|
||||
await Groups.RemoveFromGroupAsync(connectionId, webinarName);
|
||||
|
||||
//
|
||||
// Check Exists or not ...
|
||||
var groupEntity = await webinarGroupStore.FindOneAsync(x => x.WebinarId == webinarId);
|
||||
if (!groupEntity.IsNullOrDefault())
|
||||
{
|
||||
await webinarGroupStore.RemoveAsync(groupEntity.Id);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a Webinar Subscriber Joined to Opened Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task ViewerJoined(Guid webinarId)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = !webinarId.IsNull() &&
|
||||
!webinarId.IsDefaultGuid();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invalid Webinar Provider ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
isValid = !userInfo.IsNullOrDefault() &&
|
||||
!connectionId.IsNullOrEmpty();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invaid User Info ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Reading Webinar ...
|
||||
var webinar = await webinarProvider.GetWebinar(webinarId);
|
||||
isValid = !webinar.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Webinar Not Found ...");
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate User is Webinar Subscriber ...
|
||||
// Or Webinar is Open ...
|
||||
if (webinar.Type != XWebinarType.Public)
|
||||
{
|
||||
//
|
||||
isValid = await webinarProvider.IsSubscribed(
|
||||
webinarId: webinarId,
|
||||
subscriberId: userInfo.UserId
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError("User Not Have Permission to Join Webinar ...");
|
||||
XException.NotAllowed.Throw();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
var webinarName = webinarId.ToString();
|
||||
|
||||
//
|
||||
// Add User to Webinar ...
|
||||
await Groups.AddToGroupAsync(connectionId, webinarName);
|
||||
|
||||
//
|
||||
// Notify Other Users which a Viewer Joined ...
|
||||
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerJoined.GetStringValue(),
|
||||
connectionId,
|
||||
webinarId,
|
||||
userInfo.UserId,
|
||||
userInfo.UserName
|
||||
);
|
||||
|
||||
//
|
||||
// Check Exists or not ...
|
||||
var connection = new XHubConnectionDto
|
||||
{
|
||||
UserId = userInfo.UserId,
|
||||
ConnectionId = connectionId,
|
||||
Username = userInfo.UserName,
|
||||
};
|
||||
var groupEntity = await webinarGroupStore.FindOneAsync(x => x.WebinarId == webinarId);
|
||||
if (!groupEntity.IsNullOrDefault())
|
||||
{
|
||||
//
|
||||
// Check Current User ID Exists ...
|
||||
var userConnection = groupEntity.Connections.FirstOrDefault(c => c.UserId == userInfo.UserId);
|
||||
if (!userConnection.IsNullOrDefault())
|
||||
{
|
||||
userConnection.ConnectionId = connectionId;
|
||||
}
|
||||
else
|
||||
{
|
||||
groupEntity.Connections.Add(connection);
|
||||
}
|
||||
|
||||
//
|
||||
await webinarGroupStore.UpdateAsync(groupEntity.Id, groupEntity);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// a Webina Subscriber Lefts Group ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task ViewerLeaved(Guid webinarId)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = !webinarId.IsNull() &&
|
||||
!webinarId.IsDefaultGuid();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invalid Webinar Provider ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
isValid = !userInfo.IsNullOrDefault() &&
|
||||
!connectionId.IsNullOrEmpty();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invaid User Info ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Reading Webinar ...
|
||||
var webinar = await webinarProvider.GetWebinar(webinarId);
|
||||
isValid = !webinar.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Webinar Not Found ...");
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate User is Webinar Subscriber ...
|
||||
// Or Webinar is Open ...
|
||||
if (webinar.Type != XWebinarType.Public)
|
||||
{
|
||||
//
|
||||
isValid = await webinarProvider.IsSubscribed(
|
||||
webinarId: webinarId,
|
||||
subscriberId: userInfo.UserId
|
||||
);
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError("User Not Have Permission to Join Webinar ...");
|
||||
XException.NotAllowed.Throw();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
var webinarName = webinarId.ToString();
|
||||
|
||||
//
|
||||
// Add User to Webinar ...
|
||||
await Groups.RemoveFromGroupAsync(connectionId, webinarName);
|
||||
|
||||
//
|
||||
// Notify Other Users which a Viewer Leaved ...
|
||||
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.ViewerLeaved.GetStringValue(),
|
||||
connectionId,
|
||||
webinarId,
|
||||
userInfo.UserId,
|
||||
userInfo.UserName
|
||||
);
|
||||
|
||||
//
|
||||
// Check Exists or not ...
|
||||
var groupEntity = await webinarGroupStore.FindOneAsync(x => x.WebinarId == webinarId);
|
||||
if (!groupEntity.IsNullOrDefault())
|
||||
{
|
||||
//
|
||||
// Check Current User ID Exists ...
|
||||
var userConnection = groupEntity.Connections.FirstOrDefault(c => c.ConnectionId == connectionId);
|
||||
if (!userConnection.IsNullOrDefault())
|
||||
{
|
||||
groupEntity.Connections.Remove(userConnection);
|
||||
}
|
||||
|
||||
//
|
||||
await webinarGroupStore.UpdateAsync(groupEntity.Id, groupEntity);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a Collection of Webinars Visitors ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task<IEnumerable<XHubConnectionDto>> WebinarVisitors(Guid webinarId)
|
||||
{
|
||||
//
|
||||
var result = new List<XHubConnectionDto>();
|
||||
|
||||
//
|
||||
// Reading and Validate Requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
|
||||
|
||||
//
|
||||
// Check Group Exists ...
|
||||
var groupEntity = await webinarGroupStore.FindOneAsync(x => x.WebinarId == webinarId);
|
||||
if (!groupEntity.IsNullOrDefault())
|
||||
{
|
||||
//
|
||||
// Validate Requester is a Viewer ...
|
||||
var connection = groupEntity.Connections.FirstOrDefault(c => c.ConnectionId == connectionId ||
|
||||
c.UserId == userInfo.UserId
|
||||
);
|
||||
if (!connection.IsNullOrDefault())
|
||||
{
|
||||
result = groupEntity.Connections;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a Message to Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task Message(Guid webinarId, string message)
|
||||
{
|
||||
//
|
||||
// Validate ...
|
||||
var isValid = !webinarId.IsNull() &&
|
||||
!webinarId.IsDefaultGuid();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invalid Webinar Provider ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieve requirements ...
|
||||
var userInfo = Context.GetUserInfo();
|
||||
var connectionId = Context.ConnectionId;
|
||||
isValid = !userInfo.IsNullOrDefault() &&
|
||||
!connectionId.IsNullOrEmpty();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Invaid User Info ...");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
try
|
||||
{
|
||||
//
|
||||
// Reading Webinar ...
|
||||
var webinar = await webinarProvider.GetWebinar(webinarId);
|
||||
isValid = !webinar.IsNullOrDefault();
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError($"Webinar Not Found ...");
|
||||
XException.NotFound.Throw();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate User is Webinar Owner or Subscriber ...
|
||||
// Or Webinar is Open ...
|
||||
if (webinar.Type != XWebinarType.Public)
|
||||
{
|
||||
//
|
||||
isValid = userInfo.UserId == webinar.OwnerId ||
|
||||
(await webinarProvider.IsSubscribed(
|
||||
webinarId: webinarId,
|
||||
subscriberId: userInfo.UserId
|
||||
));
|
||||
if (!isValid)
|
||||
{
|
||||
//
|
||||
logger.LogError("User Not Have Permission to Join Webinar ...");
|
||||
XException.NotAllowed.Throw();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
var webinarName = webinarId.ToString();
|
||||
|
||||
//
|
||||
// Notify Other Users which a Viewer Leaved ...
|
||||
await Clients.OthersInGroup(webinarName).SendAsync(XWebinarHubAction.Message.GetStringValue(),
|
||||
connectionId,
|
||||
userInfo.UserId,
|
||||
userInfo.UserName,
|
||||
message
|
||||
);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarDtoHub : IXBaseDtoHub<XWebinar, XWebinarDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarRepositoryService : IXBaseRepositoryService<XWebinar, XWebinarDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
using xWebinarService.Providers.Dtos;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarServiceProvider : IXBaseDtoProvider<XWebinar, XWebinarDto, Guid, XWebinarDtoHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarSubscriberDtoHub : IXBaseDtoHub<XWebinarSubscriber, XWebinarSubscriberDto, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarSubscriberRepositoryService : IXBaseRepositoryService<XWebinarSubscriber, XWebinarSubscriberDto, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace xWebinarService.Interfaces.Dtos
|
||||
{
|
||||
public interface IXWebinarSubscriberServiceProvider
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarEntityHub : IXBaseEntityHub<XWebinar, Guid>
|
||||
{ }
|
||||
}
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberEvents : IXBaseRepositoryEvents<XWebinarSubscriber>
|
||||
public interface IXWebinarKeyGenerator : IXKeyGenerator<XWebinar, Guid>
|
||||
{ }
|
||||
}
|
||||
+1
-1
@@ -3,6 +3,6 @@ using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarEvents : IXBaseRepositoryEvents<XWebinar>
|
||||
public interface IXWebinarRepositoryEvents : IXBaseRepositoryEvents<XWebinar>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
using xWebinarService.Providers.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarRepositoryProvider : IXBaseEntityProvider<XWebinar, Guid, XWebinarEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSeeder : IXBaseDbSeeder<XWebinar, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberEntityHub : IXBaseEntityHub<XWebinarSubscriber, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberKeyGenerator : IXKeyGenerator<XWebinarSubscriber, int>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberRepositoryEvents : IXBaseRepositoryEvents<XWebinarSubscriber>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xPushService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
using xWebinarService.Providers.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberRepositoryProvider : IXBaseEntityProvider<XWebinarSubscriber, int, XWebinarSubscriberEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces.Entities
|
||||
{
|
||||
public interface IXWebinarSubscriberSeeder : IXBaseDbSeeder<XWebinarSubscriber, int>
|
||||
{ }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarDescriptionResourceProvider : IXBaseStringResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
using xFileService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarFileProvider : IXBaseFileProvider<Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarGroupStore : IXBaseRepository<XWebinarGroupEntity, Guid>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,423 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityModels.Models;
|
||||
using xIdentityService.Interfaces;
|
||||
using xModels.Dtos;
|
||||
using xWebinarService.Hubs;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
using XFileDto = xFileService.Models.Dtos.XFileDto;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarProvider
|
||||
{
|
||||
//
|
||||
#region Props ...
|
||||
IHubContext<XWebinarEntityHub> Hub { get; }
|
||||
IXIdentityProvider IdentityProvider { get; }
|
||||
IXWebinarRepository WebinarRepository { get; }
|
||||
IXWebinarTagProvider WebinarTagProvider { get; }
|
||||
IXWebinarFileProvider WebinarFileProvider { 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>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> CreateWebinar(
|
||||
XWebinarDto item,
|
||||
IEnumerable<string> tags = null,
|
||||
IFormFileCollection files = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarDto> UpdateWebinar(
|
||||
XWebinarDto item,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <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>
|
||||
/// Conditional Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="whereClause"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> ConditionalQueryWebinars(
|
||||
Expression<Func<XWebinarDto, bool>> whereClause,
|
||||
XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryOwnedWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarDto>> QueryJoinableWebinars(
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> RemoveWebinar(
|
||||
Guid webinarId,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region WebinarSubscriber ...
|
||||
/// <summary>
|
||||
/// Subscribe a User to Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Subscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Check Specified User Subscribed on a Webinar or not ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> IsSubscribed(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribe Specified User from a Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> Unsubscribe(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Subscriber ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<XWebinarSubscriberDto> GetSubscriber(
|
||||
Guid webinarId,
|
||||
string subscriberId,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Specified Webinars Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XWebinarSubscriberDto>> GetSubscribers(
|
||||
Guid webinarId,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Specified Webinar's Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="webinarId"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<XQueryResult<XWebinarSubscriberDto>> QuerySubscribers(
|
||||
Guid webinarId,
|
||||
XQuery query,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region File Actions ...
|
||||
/// <summary>
|
||||
/// Upload Files ...
|
||||
/// </summary>
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XFileDto>> UploadFiles(
|
||||
Guid id,
|
||||
IFormFileCollection files,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Files ...
|
||||
/// </summary>
|
||||
/// <param name="forProvidedId"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<Guid>> RemoveFiles(
|
||||
Guid id,
|
||||
string ids = null,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get Webinar Files ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<XFileDto>> GetFiles(
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Stream Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<FileStreamResult> StreamFile(
|
||||
Guid id,
|
||||
Guid fileId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Stream Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<PhysicalFileResult> DownloadFile(
|
||||
Guid id,
|
||||
Guid fileId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Attach Provided Files to Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task AttachFiles(
|
||||
Guid id,
|
||||
string ids,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Provided Files to Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids">if null, detach all files ...</param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task DetachFiles(
|
||||
Guid id,
|
||||
string ids,
|
||||
string connectionId = null,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tags Actions ...
|
||||
/// <summary>
|
||||
/// Attach Tag to Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task AttachTag(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tag fro Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="tag"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task DetachTag(
|
||||
string tag,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Attach Tags for Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceAttachToFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task AttachTags(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceAttachToFiles = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Tags for Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task DetachTags(
|
||||
IEnumerable<string> tags,
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach all Attached Tags for Specified File ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="connectionId"></param>
|
||||
/// <param name="forceDetachFromFiles"></param>
|
||||
/// <returns></returns>
|
||||
Task DetachTags(
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null,
|
||||
string connectionId = null,
|
||||
bool forceDetachFromFiles = true
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar's Tags ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<string>> GetTags(
|
||||
Guid id,
|
||||
XUserClaimsInfoDto userInfo = null
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using xModels.Dtos;
|
||||
using XFileDto = xFileService.Models.Dtos.XFileDto;
|
||||
using xWebinarService.Models.Dtos;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// an Interface to Provides Webinar Provider Actions ...
|
||||
/// </summary>
|
||||
public interface IXWebinarServiceControllerActions
|
||||
{
|
||||
//
|
||||
#region Actions ...
|
||||
/// <summary>
|
||||
/// Create Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> CreateWebinar(
|
||||
[FromForm] XWebinarDto item,
|
||||
[FromQuery] string tags = null,
|
||||
[FromForm] IFormFileCollection files = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Update a Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> UpdateWebinar(
|
||||
[FromRoute] Guid id,
|
||||
[FromBody] XWebinarDto item
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarDto>> GetWebinar(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all Exists Webinars ...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XWebinarDto>>> GetWebinars();
|
||||
|
||||
/// <summary>
|
||||
/// Query Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Owned Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryOwnedWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Joinable Webinars ...
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarDto>>> QueryJoinableWebinars(
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<bool>> RemoveWebinar(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region WebinarSubscriber ...
|
||||
/// <summary>
|
||||
/// Subscribe a User to Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<bool>> Subscribe(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] string subscriberId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Check Specified User Subscribed on a Webinar or not ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<bool>> IsSubscribed(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] string subscriberId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribe Specified User from a Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<bool>> Unsubscribe(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] string subscriberId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Subscriber ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="subscriberId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XWebinarSubscriberDto>> GetSubscriber(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] string subscriberId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Get all Specified Webinars Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XWebinarSubscriberDto>>> GetSubscribers(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Query Specified Webinar's Subscribers ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<XQueryResult<XWebinarSubscriberDto>>> QuerySubscribers(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] XQuery query
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region File Actions ...
|
||||
/// <summary>
|
||||
/// Upload Specified Files for Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="files"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> UploadFiles(
|
||||
[FromRoute] Guid id,
|
||||
[FromForm] IFormFileCollection files
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Remove Specified (All) Files of Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> RemoveFiles(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string ids = null
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinar's Files ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<XFileDto>>> GetFiles(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Stream Specified File of Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> StreamFile(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] Guid fileId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Download Specified File of Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="fileId"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> DownloadFile(
|
||||
[FromRoute] Guid id,
|
||||
[FromRoute] Guid fileId
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Attach Provided Files to Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/Files/AttachMany")]
|
||||
Task<ActionResult> AttachFiles(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string ids
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Provided Files to Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="ids">if null, detach all files ...</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/Files/DetachMany")]
|
||||
Task<ActionResult> DetachFiles(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string ids = null
|
||||
);
|
||||
#endregion
|
||||
|
||||
//
|
||||
#region Tags Actions ...
|
||||
/// <summary>
|
||||
/// Attach Specified Tags To Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> AttachTags(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Detach Specified Tags From Specified Webinar ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="tags"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult> DetachTags(
|
||||
[FromRoute] Guid id,
|
||||
[FromQuery] string tags
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve Specified Webinars Tags ...
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ActionResult<IEnumerable<string>>> GetTags(
|
||||
[FromRoute] Guid id
|
||||
);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
using xTagService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarTagProvider : IXBaseTagProvider<Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xWebinarService.Interfaces
|
||||
{
|
||||
public interface IXWebinarTitleResourceProvider : IXBaseStringResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -5,24 +5,14 @@ using xWebinarService.Constants;
|
||||
|
||||
namespace xWebinarService.Models.Dtos
|
||||
{
|
||||
public class XWebinarDto : XBaseDto
|
||||
public class XWebinarDto : XBaseGuidIDEntityDto
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public XResourceDto Title { get; set; }
|
||||
public XResourceDto Description { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
public string OwnerId { get; set; }
|
||||
public XPersonDto Owner { get; set; }
|
||||
public XWebinarType Type { get; set; }
|
||||
public XResourceDto Title { get; set; }
|
||||
public DateTime CreatedOn { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
public class XWebinarSubscriberDto : XBaseDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public Guid WebinarId { get; set; }
|
||||
public string SubscriberId { get; set; }
|
||||
public XPersonDto Subscriber { get; set; }
|
||||
public DateTime SubscribedOn { get; set; }
|
||||
public XResourceDto Description { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xWebinarService.Models.Dtos
|
||||
{
|
||||
public class XWebinarSubscriberDto : XBaseIntIDEntityDto
|
||||
{
|
||||
public Guid WebinarId { get; set; }
|
||||
public string SubscriberId { get; set; }
|
||||
public XPersonDto Subscriber { get; set; }
|
||||
public DateTime SubscribedOn { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -49,18 +49,6 @@ namespace xWebinarService.Models.Entities
|
||||
/// Specified Webinar Enabled or not ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Webinar Subscriber ...
|
||||
/// </summary>
|
||||
public class XWebinarSubscriber : XBaseIntIDEntity
|
||||
{
|
||||
[Required]
|
||||
public string SubscriberId { get; set; }
|
||||
[Required]
|
||||
public Guid WebinarId { get; set; }
|
||||
public DateTime SubscribedOn { get; set; }
|
||||
public bool Enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using xModels.Base;
|
||||
using xPushService.Base;
|
||||
|
||||
namespace xWebinarService.Models.Entities
|
||||
{
|
||||
public class XWebinarGroupEntity : XBaseGuidIDEntity
|
||||
{
|
||||
public Guid WebinarId { get; set; }
|
||||
public List<XHubConnectionDto> Connections { get; set; } = new List<XHubConnectionDto>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xWebinarService.Models.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Webinar Subscriber ...
|
||||
/// </summary>
|
||||
public class XWebinarSubscriber : XBaseIntIDEntity
|
||||
{
|
||||
[Required]
|
||||
public string SubscriberId { get; set; }
|
||||
|
||||
[Required]
|
||||
public Guid WebinarId { get; set; }
|
||||
|
||||
public DateTime SubscribedOn { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarDtoHub : XBaseDtoHub<XWebinar, XWebinarDto, Guid>, IXWebinarDtoHub
|
||||
{
|
||||
public XWebinarDtoHub(
|
||||
ILogger<XWebinarDtoHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarRepositoryService : XBaseRepositoryService<XWebinar, XWebinarDto, Guid>, IXWebinarRepositoryService
|
||||
{
|
||||
public XWebinarRepositoryService(
|
||||
IXWebinarRepository repository,
|
||||
IEnumerable<Profile> mapperProfiles = null
|
||||
) : base(
|
||||
repository,
|
||||
mapperProfiles
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarServiceProvider : XBaseDtoProvider<XWebinar, XWebinarDto, Guid, XWebinarDtoHub>, IXWebinarServiceProvider
|
||||
{
|
||||
public XWebinarServiceProvider(
|
||||
IHubContext<XWebinarDtoHub> hub,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXWebinarRepositoryService service,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
dataConfiguration,
|
||||
service,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarSubscriberDtoHub : XBaseDtoHub<XWebinarSubscriber, XWebinarSubscriberDto, int>, IXWebinarSubscriberDtoHub
|
||||
{
|
||||
public XWebinarSubscriberDtoHub(
|
||||
ILogger<XWebinarSubscriberDtoHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarSubscriberRepositoryService : XBaseRepositoryService<XWebinarSubscriber, XWebinarSubscriberDto, int>, IXWebinarSubscriberRepositoryService
|
||||
{
|
||||
public XWebinarSubscriberRepositoryService(
|
||||
IXWebinarSubscriberRepository repository,
|
||||
IEnumerable<Profile> mapperProfiles = null
|
||||
) : base(
|
||||
repository,
|
||||
mapperProfiles
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Dtos;
|
||||
using xWebinarService.Models.Dtos;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Dtos
|
||||
{
|
||||
public class XWebinarSubscriberServiceProvider : XBaseDtoProvider<XWebinarSubscriber, XWebinarSubscriberDto, int, XWebinarSubscriberDtoHub>, IXWebinarSubscriberServiceProvider
|
||||
{
|
||||
public XWebinarSubscriberServiceProvider(
|
||||
IHubContext<XWebinarSubscriberDtoHub> hub,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXWebinarSubscriberRepositoryService service,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
dataConfiguration,
|
||||
service,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarEFRepository<TContext> : XBaseEFRepository<XWebinar, Guid, TContext>, IXWebinarRepository
|
||||
where TContext : XDbContext
|
||||
{
|
||||
public XWebinarEFRepository(
|
||||
IXUnitOfWorks<TContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXWebinarKeyGenerator keyGenerator = null,
|
||||
IXWebinarRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarEntityHub : XBaseEntityHub<XWebinar, Guid>, IXWebinarEntityHub
|
||||
{
|
||||
public XWebinarEntityHub(
|
||||
ILogger<XWebinarEntityHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarInMemoryRepository : XBaseInMemoryRepository<XWebinar, Guid>, IXWebinarRepository
|
||||
{
|
||||
public XWebinarInMemoryRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXWebinarKeyGenerator keyGenerator = null,
|
||||
IXWebinarRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarKeyGenerator : XGuidKeyGenerator<XWebinar>, IXWebinarKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarMongoRepository : XBaseMongoRepository<XWebinar, Guid>, IXWebinarRepository
|
||||
{
|
||||
public XWebinarMongoRepository(
|
||||
XDataBaseConfiguration dbConfiguration,
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXWebinarKeyGenerator keyGenerator = null,
|
||||
IXWebinarRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
dbConfiguration,
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarRepositoryEvents : XBaseRepositoryEvents<XWebinar>, IXWebinarRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarRepositoryProvider : XBaseEntityProvider<XWebinar, Guid, XWebinarEntityHub>, IXWebinarRepositoryProvider
|
||||
{
|
||||
public XWebinarRepositoryProvider(
|
||||
IHubContext<XWebinarEntityHub> hub,
|
||||
IXWebinarRepository repository,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
repository,
|
||||
dataConfiguration,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public abstract class XWebinarSeederBase : XBaseDbSeeder<XWebinar, Guid>, IXWebinarSeeder
|
||||
{
|
||||
public XWebinarSeederBase(
|
||||
string entity,
|
||||
string database,
|
||||
IXWebinarRepository repository,
|
||||
XDataServiceConfiguration dataServiceConfiguration
|
||||
) : base(
|
||||
entity,
|
||||
database,
|
||||
repository,
|
||||
dataServiceConfiguration
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberEFRepository<TContext> : XBaseEFRepository<XWebinarSubscriber, int, TContext>, IXWebinarSubscriberRepository
|
||||
where TContext : XDbContext
|
||||
{
|
||||
public XWebinarSubscriberEFRepository(
|
||||
IXUnitOfWorks<TContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXWebinarSubscriberKeyGenerator keyGenerator = null,
|
||||
IXWebinarSubscriberRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberEntityHub : XBaseEntityHub<XWebinarSubscriber, int>, IXWebinarSubscriberEntityHub
|
||||
{
|
||||
public XWebinarSubscriberEntityHub(
|
||||
ILogger<XWebinarSubscriberEntityHub> logger
|
||||
) : base(logger)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberInMemoryRepository : XBaseInMemoryRepository<XWebinarSubscriber, int>, IXWebinarSubscriberRepository
|
||||
{
|
||||
public XWebinarSubscriberInMemoryRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXWebinarSubscriberKeyGenerator keyGenerator = null,
|
||||
IXWebinarSubscriberRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberKeyGenerator : XIntKeyGenerator<XWebinarSubscriber>, IXWebinarSubscriberKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberMongoRepository : XBaseMongoRepository<XWebinarSubscriber, int>, IXWebinarSubscriberRepository
|
||||
{
|
||||
public XWebinarSubscriberMongoRepository(
|
||||
XDataBaseConfiguration dbConfiguration,
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXWebinarSubscriberKeyGenerator keyGenerator = null,
|
||||
IXWebinarSubscriberRepositoryEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
dbConfiguration,
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberRepositoryEvents : XBaseRepositoryEvents<XWebinarSubscriber>, IXWebinarSubscriberRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using xDataService.Configuration;
|
||||
using xIdentityService.Interfaces;
|
||||
using xPushService.Base;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public class XWebinarSubscriberRepositoryProvider : XBaseEntityProvider<XWebinarSubscriber, int, XWebinarSubscriberEntityHub>, IXWebinarSubscriberRepositoryProvider
|
||||
{
|
||||
public XWebinarSubscriberRepositoryProvider(
|
||||
IHubContext<XWebinarSubscriberEntityHub> hub,
|
||||
IXWebinarSubscriberRepository repository,
|
||||
XDataServiceConfiguration dataConfiguration,
|
||||
IXIdentityProvider identityProvider = null
|
||||
) : base(
|
||||
hub,
|
||||
repository,
|
||||
dataConfiguration,
|
||||
identityProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers.Entities
|
||||
{
|
||||
public abstract class XWebinarSubscriberSeederBase : XBaseDbSeeder<XWebinarSubscriber, int>, IXWebinarSubscriberSeeder
|
||||
{
|
||||
public XWebinarSubscriberSeederBase(
|
||||
string entity,
|
||||
string database,
|
||||
IXWebinarSubscriberRepository repository,
|
||||
XDataServiceConfiguration dataServiceConfiguration
|
||||
) : base(
|
||||
entity,
|
||||
database,
|
||||
repository,
|
||||
dataServiceConfiguration
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarGraphQLTypeHelper : XBaseGraphQLTypeHelper<XWebinar, Guid>, IXWebinarGraphQLTypeHelper
|
||||
{
|
||||
@@ -15,12 +16,12 @@ namespace xWebinarService.DataHelper.GraphQL
|
||||
|
||||
public override string GetInQueryCollectionName()
|
||||
{
|
||||
return "webinars";
|
||||
return XWebinarServiceConstants.XWebinarCollectionName;
|
||||
}
|
||||
|
||||
public override string GetInQuerySingleName()
|
||||
{
|
||||
return "webinar";
|
||||
return XWebinarServiceConstants.XWebinarSingleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ using xDataService.GraphQL;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarGraphQuery : XBaseGraphQLQuery<XWebinar, Guid, XWebinarGraphType, GuidGraphType>
|
||||
{
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarGraphSchema : Schema
|
||||
{
|
||||
@@ -2,16 +2,18 @@ using System;
|
||||
using xDataService.GraphQL;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarGraphType : XBaseGraphObjectType<XWebinar, Guid>
|
||||
{
|
||||
public XWebinarGraphType() : base()
|
||||
{
|
||||
Field(x => x.Type);
|
||||
Field(x => x.Title);
|
||||
Field(x => x.Description);
|
||||
Field(x => x.OwnerId);
|
||||
Field(x => x.Enabled);
|
||||
Field(x => x.CreatedOn);
|
||||
Field(x => x.Description);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -1,28 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.GraphQL;
|
||||
using xWebinarService.Constants;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarSubscriberGraphQLTypeHelper : XBaseGraphQLTypeHelper<XWebinarSubscriber, int>, IXWebinarSubscriberGraphQLTypeHelper
|
||||
{
|
||||
public XWebinarSubscriberGraphQLTypeHelper(
|
||||
XDataServiceConfiguration configuration
|
||||
) : base(configuration) { }
|
||||
|
||||
) : base(configuration)
|
||||
{ }
|
||||
|
||||
public override string GetInQueryCollectionName()
|
||||
{
|
||||
return "webinarSubscribers";
|
||||
return XWebinarServiceConstants.XWebinarSubscriberCollectionName;
|
||||
}
|
||||
|
||||
public override string GetInQuerySingleName()
|
||||
{
|
||||
return "webinarSubscriber";
|
||||
return XWebinarServiceConstants.XWebinarSubscriberSingleName;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -4,7 +4,7 @@ using xDataService.GraphQL;
|
||||
using xWebinarService.Interfaces.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarSubscriberGraphQuery : XBaseGraphQLQuery<XWebinarSubscriber, int, XWebinarSubscriberGraphType, IntGraphType>
|
||||
{
|
||||
@@ -17,7 +17,6 @@ namespace xWebinarService.DataHelper.GraphQL
|
||||
repository,
|
||||
helper
|
||||
)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using GraphQL.Types;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarSubscriberGraphSchema : Schema
|
||||
{
|
||||
+2
-2
@@ -1,15 +1,15 @@
|
||||
using xDataService.GraphQL;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.DataHelper.GraphQL
|
||||
namespace xWebinarService.Providers.GraphQL
|
||||
{
|
||||
public class XWebinarSubscriberGraphType : XBaseGraphObjectType<XWebinarSubscriber, int>
|
||||
{
|
||||
public XWebinarSubscriberGraphType() : base()
|
||||
{
|
||||
Field(x => x.SubscriberId);
|
||||
Field(x => x.WebinarId);
|
||||
Field(x => x.SubscribedOn);
|
||||
Field(x => x.SubscriberId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Configurations.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
public class XWebinarEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
|
||||
{
|
||||
public XWebinarEntityRegisterar()
|
||||
: base(nameof(XWebinarEntityRegisterar))
|
||||
{
|
||||
//
|
||||
// Add Entity ...
|
||||
AddEntity<XWebinar, Guid>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure Entities ...
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
//
|
||||
// Configure Entity Using Provided ...
|
||||
modelBuilder
|
||||
.ApplyConfigurationsFromAssembly(typeof(XWebinarEntityConfiguration).Assembly);
|
||||
|
||||
//
|
||||
base.ConfigureEntities(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using xFileService.Interfaces;
|
||||
using xFileService.Providers;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
public class XWebinarFileProvider : XBaseFileProvider<Guid>, IXWebinarFileProvider
|
||||
{
|
||||
public XWebinarFileProvider(
|
||||
IXFileProvider fileProvider
|
||||
) : base(
|
||||
providedFor: nameof(XWebinar),
|
||||
fileProvider: fileProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.InMemRepositories;
|
||||
using xDataService.Interfaces;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
public class XWebinarGroupStore : XBaseInMemoryRepositoy<XWebinarGroupEntity, Guid>, IXWebinarGroupStore
|
||||
{
|
||||
public XWebinarGroupStore(
|
||||
XDataServiceConfiguration configuration,
|
||||
IXKeyGenerator<XWebinarGroupEntity, Guid> keyGenerator = null,
|
||||
IXBaseRepositoryEvents<XWebinarGroupEntity> baseRepositoryEvents = null
|
||||
) : base(configuration, keyGenerator, baseRepositoryEvents)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.Providers;
|
||||
using xWebinarService.Configurations.Entities;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
public class XWebinarSubscriberEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
|
||||
{
|
||||
public XWebinarSubscriberEntityRegisterar()
|
||||
: base(nameof(XWebinarSubscriberEntityRegisterar))
|
||||
{
|
||||
//
|
||||
// Add Entity ...
|
||||
AddEntity<XWebinarSubscriber, int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configure Entities ...
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public override void ConfigureEntities(ModelBuilder modelBuilder)
|
||||
{
|
||||
//
|
||||
// Configure Entity Using Provided ...
|
||||
modelBuilder
|
||||
.ApplyConfigurationsFromAssembly(typeof(XWebinarSubscriberEntityConfiguration).Assembly);
|
||||
|
||||
//
|
||||
base.ConfigureEntities(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using xTagService.Interfaces;
|
||||
using xTagService.Providers;
|
||||
using xWebinarService.Interfaces;
|
||||
using xWebinarService.Models.Entities;
|
||||
|
||||
namespace xWebinarService.Providers
|
||||
{
|
||||
public class XWebinarTagProvider : XBaseTagProvider<Guid>, IXWebinarTagProvider
|
||||
{
|
||||
public XWebinarTagProvider(
|
||||
IXTagProvider tagProvider
|
||||
) : base(
|
||||
providedFor: nameof(XWebinar),
|
||||
tagProvider: tagProvider
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<!-- <add key="megan" value="https://hub.megan.ir/nuget/index.json" /> -->
|
||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
<add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" />
|
||||
<add key="baget" value="https://nuget.saherelmhub.ir/v3/index.json" protocolVersion="3" disableTLSCertificateValidation="true" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
+8
-15
@@ -2,13 +2,15 @@
|
||||
|
||||
<!-- Runtime Definition -->
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<PackageId>xDashboard.xWebinarService</PackageId>
|
||||
<Version>1.0.0</Version>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<Authors>Hadi Khazaee Asl</Authors>
|
||||
<Company>SaherElm IT Center</Company>
|
||||
<PackageId>xDashboard.xWebinarService</PackageId>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
||||
<Description>
|
||||
it is a Part of xDashboard on SaherElm IT Center which provides all Wbinar Related Futures ...
|
||||
it is a Part of xDashboard on SaherElm IT Center which provides all Wbinar Related Futures ...
|
||||
</Description>
|
||||
|
||||
<!-- Icon Definition -->
|
||||
@@ -17,26 +19,17 @@
|
||||
|
||||
<!-- Icon Handling -->
|
||||
<ItemGroup>
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true" PackagePath="\icon.png" />
|
||||
<None Include="../../Resources/Images/favicon.png" Link="icon.png" Pack="true"
|
||||
PackagePath="\icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Local Modules -->
|
||||
<ItemGroup>
|
||||
<!-- <PackageReference Include="xDashboard.xDataService" Version="1.0.0" /> -->
|
||||
<PackageReference Include="xDashboard.xStringService" Version="1.0.0" />
|
||||
<!-- <PackageReference Include="xDashboard.xIdentityService" Version="1.0.0" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Local Dependencies -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../xTagService/xTagService.csproj" />
|
||||
<ProjectReference Include="../xFileService/xFileService.csproj" />
|
||||
<ProjectReference Include="../xPushService/xPushService.csproj" />
|
||||
<ProjectReference Include="../xDataService/xDataService.csproj" />
|
||||
<ProjectReference Include="../xIdentityService/xIdentityService.csproj" />
|
||||
<!--
|
||||
<ProjectReference Include="../xStringService/xStringService.csproj" />
|
||||
-->
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user