diff --git a/Configurations/Entities/XAiConversationEntityConfiguration.cs b/Configurations/Entities/XAiConversationEntityConfiguration.cs new file mode 100644 index 0000000..8a5ed51 --- /dev/null +++ b/Configurations/Entities/XAiConversationEntityConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using xAiModels.Constants; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Configurations.Entities +{ + public class XAiConversationEntityConfiguration : XBaseEntityTypeConfiguration + { + public override void Configure(EntityTypeBuilder builder) + { + builder.ToTable(XAiModelsConstants.XAiConversationTable); + } + } +} \ No newline at end of file diff --git a/Configurations/Entities/XAiMessageEntityConfiguration.cs b/Configurations/Entities/XAiMessageEntityConfiguration.cs new file mode 100644 index 0000000..fa86cd6 --- /dev/null +++ b/Configurations/Entities/XAiMessageEntityConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using xAiModels.Constants; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Configurations.Entities +{ + public class XAiMessageEntityConfiguration : XBaseEntityTypeConfiguration + { + public override void Configure(EntityTypeBuilder builder) + { + builder.ToTable(XAiModelsConstants.XAiMessageTable); + } + } +} \ No newline at end of file diff --git a/Configurations/Entities/XAiProjectEntityConfiguration.cs b/Configurations/Entities/XAiProjectEntityConfiguration.cs new file mode 100644 index 0000000..8f456a8 --- /dev/null +++ b/Configurations/Entities/XAiProjectEntityConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using xAiModels.Constants; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Configurations.Entities +{ + public class XAiProjectEntityConfiguration : XBaseEntityTypeConfiguration + { + public override void Configure(EntityTypeBuilder builder) + { + builder.ToTable(XAiModelsConstants.XAiProjectTable); + } + } +} \ No newline at end of file diff --git a/Constants/XAiModelsConstants.cs b/Constants/XAiModelsConstants.cs new file mode 100644 index 0000000..b8fd8e5 --- /dev/null +++ b/Constants/XAiModelsConstants.cs @@ -0,0 +1,27 @@ +namespace xAiModels.Constants +{ + public struct XAiModelsConstants + { + // + // Table Mapping Identifiers ... + public const string XAiMessageTable = "AiMessages"; + public const string XAiProjectTable = "AiProjects"; + public const string XAiConversationTable = "AiConversations"; + + // + // GraphQL Collection Mappings ... + public const string XAiMessageSingleName = "aiMessage"; + public const string XAiProjectSingleName = "aiProject"; + public const string XAiConversationSignleName = "aiConversation"; + + public const string XAiMessageCollectionName = "aiMessages"; + public const string XAiProjectCollectionName = "AiProjectsa"; + public const string XAiConversationCollectionName = "aiConversations"; + + // + // Resource Provider Identifiers ... + public const string XAiProjectTitleIdentifier = "AiPrjT"; + public const string XAiProjectDescriptionIdentifier = "AiPrjD"; + public const string XAiConversationTitleIdentifier = "AiCnvrT"; + } +} \ No newline at end of file diff --git a/DI/XDIHelperExtension.cs b/DI/XDIHelperExtension.cs new file mode 100644 index 0000000..1760e4a --- /dev/null +++ b/DI/XDIHelperExtension.cs @@ -0,0 +1,429 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using xAiModels.Providers.Entities; +using xDataService.Constants; +using xDataService.Db; +using xPushService.Helpers; + +namespace xAiModels.DI +{ + public static class XDIHelperExtension + { + /// + /// Register Service ... + /// + /// + /// + /// + public static void AddXAiDataServiceService( + this IServiceCollection services, + XRepositoryType repositoryType, + ServiceLifetime lifeTime = ServiceLifetime.Scoped + ) + { + AddAiDataServiceService( + contextType: null, + services: services, + lifeTime: lifeTime, + repositoryType: repositoryType + ); + } + + /// + /// Register Service ... + /// + /// + /// + /// + /// + public static void AddXAiDataServiceService( + this IServiceCollection services, + XRepositoryType repositoryType, + ServiceLifetime lifeTime = ServiceLifetime.Scoped + ) + where TContext : XDbContext + { + AddAiDataServiceService( + services: services, + lifeTime: lifeTime, + contextType: typeof(TContext), + repositoryType: repositoryType + ); + } + + /// + /// Use XSubCategoryService Middleware ... + /// + /// + /// + public static void UseXAiDataServiceService( + this IApplicationBuilder app, + bool isDevelopmentEnvironment = false + ) + { + // + #region Using Hubs ... + // + var pushHelper = new XPushServiceHelper(); + + // + // XAiConversation ... + pushHelper.AddHub("categoryDto"); + pushHelper.AddHub("categoryEntity"); + + // + // SubCategory ... + pushHelper.AddHub("subCategoryDto"); + pushHelper.AddHub("subCategoryEntity"); + + // + app.UseXPushService(pushHelper); + #endregion + + // + // Using XAiDataService Repository Descriptor ... + if (!categoryDescriptor.IsNull()) + { + // + app.UseXRepository( + descriptor: categoryDescriptor, + isDevelopmentEnvironment: isDevelopmentEnvironment + ); + } + + // + // Using XSubCategory Repository Descriptor ... + if (!subCategoryDescriptor.IsNull()) + { + // + app.UseXRepository( + descriptor: subCategoryDescriptor, + isDevelopmentEnvironment: isDevelopmentEnvironment + ); + } + + // + // Create an Scope for Services Acces ... + // Handle Seeding Category/SubCategory Resources ... + using (var scope = app.ApplicationServices.CreateScope()) + { + // + // Retrieve Configuratuions ... + var categoryProvider = scope.ServiceProvider.GetService(); + var subCategoryProvider = scope.ServiceProvider.GetService(); + var configuration = scope.ServiceProvider.GetService(); + if (!configuration.IsNullOrDefault() && + !categoryProvider.IsNullOrDefault() && + !subCategoryDescriptor.IsNullOrDefault() + ) + { + // + // Logging ... + Log("Start Seeding ..."); + + // + // Count Data in Category ... + var hasCategory = (categoryProvider.Count().GetAwaiter().GetResult()) > 0; + var hasSubCategory = (subCategoryProvider.Count().GetAwaiter().GetResult()) > 0; + + // + // Seed Category Resources ... + var canSeed = + !hasCategory && + configuration.Categories.HasChild(); + if (canSeed) + { + // + // Loop through Provided items ... + foreach (var cat in configuration.Categories) + { + // + try + { + // + Log($"Start Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} ..."); + + // + categoryProvider.Refresh( + resource: cat, + userInfo: null, + connectionId: null, + cancellationToken: default + ) + .GetAwaiter() + .GetResult(); + + // + Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Finished Successfully ..."); + } + catch (Exception ex) + { + Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ..."); + } + } + } + + // + // Seed SubCategory Resources ... + canSeed = + !hasSubCategory && + configuration.SubCategories.HasChild(); + if (canSeed) + { + // + // Loop through Provided items ... + foreach (var subcat in configuration.SubCategories) + { + // + try + { + // + Log($"Start Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} ..."); + + // + subCategoryProvider.Refresh( + userInfo: null, + resource: subcat, + connectionId: null, + cancellationToken: default + ) + .GetAwaiter() + .GetResult(); + + // + Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Finished Successfully ..."); + } + catch (Exception ex) + { + Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ..."); + } + } + } + + // + Log("Finish Seeding ..."); + } + } + } + + // + #region Private ... + private static XRepositoryDescriptor categoryDescriptor = null; + private static XRepositoryDescriptor subCategoryDescriptor = null; + + /// + /// a LogTag for Service ... + /// + private static string XLogTag = "XAiDataServiceService"; + + /// + /// print a log in Console ... + /// + /// + private static void Log(string message) + { + Console.WriteLine($"{XLogTag} => {message}"); + } + + /// + /// Register Service ... + /// + /// + /// + /// + /// + private static void AddCategoryService( + IServiceCollection services, + XRepositoryType repositoryType, + Type contextType = null, + ServiceLifetime lifeTime = ServiceLifetime.Scoped + ) + { + // + var exception = XException.InvalidArgs.ToException(); ; + + // + // Services ... + var isServicesExists = !services.IsNull(); + if (!isServicesExists) + { + // + Log("Service Registration failed, services not provided ..."); + throw exception; + } + + // + // Lifetime ... + var isLifetimeExists = !lifeTime.IsNull(); + if (!isLifetimeExists) + { + // + Log("Service Registration failed, lifetime not provided ..."); + throw exception; + } + + // + // Validate Repository Type ... + var isRepositoryTypeValid = + (repositoryType == XRepositoryType.EF && + !contextType.IsNull()) || + ((repositoryType == XRepositoryType.Mongo || + repositoryType == XRepositoryType.InMemory) && + contextType.IsNull()); + if (!isRepositoryTypeValid) + { + // + Log("Service Registration failed, Invalid Repository Type and Context Type ..."); + throw exception; + } + + // + // Maske Instance of Repository Descriptor + // Based on Provided Type ... + switch (repositoryType) + { + // + case XRepositoryType.EF: + // + // Category ... + categoryDescriptor = typeof(XAiDataServiceServiceHelper) + .InvokeGenericMethod( + methodName: "GetXAiDataServiceEFRepositoryDescriptor", + runtimeType: contextType, + args: null + ); + + // + // SubCategory ... + subCategoryDescriptor = typeof(XAiDataServiceServiceHelper) + .InvokeGenericMethod( + methodName: "GetXSubCategoryEFRepositoryDescriptor", + runtimeType: contextType, + args: null + ); + break; + + // + case XRepositoryType.Mongo: + // + // Category ... + categoryDescriptor = XAiDataServiceServiceHelper.GetXAiDataServiceMongoRepositoryDescriptor(); + + // + // SubCategory ... + subCategoryDescriptor = XAiDataServiceServiceHelper.GetXSubCategoryMongoRepositoryDescriptor(); + break; + + // + case XRepositoryType.InMemory: + // + // Category ... + categoryDescriptor = XAiDataServiceServiceHelper.GetXAiDataServiceInMemoryRepositoryDescriptor(); + + // + // SubCategory ... + subCategoryDescriptor = XAiDataServiceServiceHelper.GetXSubCategoryInMemoryRepositoryDescriptor(); + break; + } + + // + // Register Category Repository Descriptor ... + if (!categoryDescriptor.IsNull()) + { + // + services.AddXRepository( + lifeTime: lifeTime, + descriptor: categoryDescriptor + ); + } + + // + // Register SubCategory Repository Descriptor ... + if (!subCategoryDescriptor.IsNull()) + { + // + services.AddXRepository( + lifeTime: lifeTime, + descriptor: subCategoryDescriptor + ); + } + + // + #region Register Services ... + // + #region Category ... + // + // Models ... + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceServiceProvider), typeof(XAiDataServiceServiceProvider), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceRepositoryService), typeof(XAiDataServiceRepositoryService), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceRepositoryProvider), typeof(XAiDataServiceRepositoryProvider), lifeTime) + ); + + // + // Resource Providers ... + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceTitleResourceProvider), typeof(XAiDataServiceTitleResourceProvider), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceDescriptionResourceProvider), typeof(XAiDataServiceDescriptionResourceProvider), lifeTime) + ); + + // + // Reference Providers ... + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceSubCategoryReferenceProvider), typeof(XAiDataServiceSubCategoryReferenceProvider), lifeTime) + ); + + // + // Provider ... + services.Add( + new ServiceDescriptor(typeof(IXAiDataServiceProvider), typeof(XAiDataServiceProvider), lifeTime) + ); + #endregion + + // + #region SubCategory ... + // + // Models ... + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryServiceProvider), typeof(XSubCategoryServiceProvider), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryRepositoryService), typeof(XSubCategoryRepositoryService), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryRepositoryProvider), typeof(XSubCategoryRepositoryProvider), lifeTime) + ); + + // + // Resource Providers ... + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryTitleResourceProvider), typeof(XSubCategoryTitleResourceProvider), lifeTime) + ); + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryDescriptionResourceProvider), typeof(XSubCategoryDescriptionResourceProvider), lifeTime) + ); + + // + // Provider ... + services.Add( + new ServiceDescriptor(typeof(IXSubCategoryProvider), typeof(XSubCategoryProvider), lifeTime) + ); + #endregion + #endregion + + // + Log("Service Regitration Succeed ..."); + } + #endregion + } +} \ No newline at end of file diff --git a/Helpers/XAiModelsHelper.cs b/Helpers/XAiModelsHelper.cs new file mode 100644 index 0000000..ff7a83e --- /dev/null +++ b/Helpers/XAiModelsHelper.cs @@ -0,0 +1,816 @@ +using System; +using GraphQL.Types; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xAiModels.Providers.Entities; +using xAiModels.Providers.GraphQL; +using xDataService.Db; +using xDataService.Models; +using xDataService.Providers; + +namespace xAiModels.Helpers +{ + public static class XAiModelsHelper + { + // + #region XAiConversation ... + // + #region EF Repository Descriptor Provider(s) ... + public static XEFRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationEFRepository, + TContext + > GetXAiConversationEFRepositoryDescriptor() + where TContext : XDbContext + { + // + var result = new XEFRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationEFRepository, + TContext + >(); + + // + return result; + } + + public static XEFRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationEFRepository, + TContext, + IXAiConversationSeeder, + TSeederImplementation + > GetXAiConversationEFRepositoryDescriptor() + where TContext : XDbContext + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XEFRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationEFRepository, + TContext, + IXAiConversationSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region Mongo Repository Descriptor Provider(s) ... + public static XMongoRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationMongoRepository + > GetXAiConversationMongoRepositoryDescriptor() + { + // + var result = new XMongoRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationMongoRepository + >(); + + // + return result; + } + + public static XMongoRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationMongoRepository, + IXAiConversationSeeder, + TSeederImplementation + > GetXAiConversationMongoRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XMongoRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationMongoRepository, + IXAiConversationSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region InMemory Repository Descriptor Provider(s) ... + public static XInMemoryRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationInMemoryRepository + > GetXAiConversationInMemoryRepositoryDescriptor() + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationInMemoryRepository + >(); + + // + return result; + } + + public static XInMemoryRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationInMemoryRepository, + IXAiConversationSeeder, + TSeederImplementation + > GetXAiConversationInMemoryRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiConversation, + Guid, + IXAiConversationKeyGenerator, + XAiConversationKeyGenerator, + IXAiConversationRepositoryEvents, + XAiConversationRepositoryEvents, + XAiConversationGraphType, + GuidGraphType, + XAiConversationGraphQuery, + IXAiConversationGraphQLTypeHelper, + XAiConversationGraphQLTypeHelper, + XAiConversationGraphSchema, + IXAiConversationRepository, + XAiConversationInMemoryRepository, + IXAiConversationSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + #endregion + + // + #region XAiMessage ... + // + #region EF Repository Descriptor Provider(s) ... + public static XEFRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageEFRepository, + TContext + > GetXAiMessageEFRepositoryDescriptor() + where TContext : XDbContext + { + // + var result = new XEFRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageEFRepository, + TContext + >(); + + // + return result; + } + + public static XEFRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageEFRepository, + TContext, + IXAiMessageSeeder, + TSeederImplementation + > GetXAiMessageEFRepositoryDescriptor() + where TContext : XDbContext + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XEFRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageEFRepository, + TContext, + IXAiMessageSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region Mongo Repository Descriptor Provider(s) ... + public static XMongoRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageMongoRepository + > GetXAiMessageMongoRepositoryDescriptor() + { + // + var result = new XMongoRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageMongoRepository + >(); + + // + return result; + } + + public static XMongoRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageMongoRepository, + IXAiMessageSeeder, + TSeederImplementation + > GetXAiMessageMongoRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XMongoRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageMongoRepository, + IXAiMessageSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region InMemory Repository Descriptor Provider(s) ... + public static XInMemoryRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageInMemoryRepository + > GetXAiMessageInMemoryRepositoryDescriptor() + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageInMemoryRepository + >(); + + // + return result; + } + + public static XInMemoryRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageInMemoryRepository, + IXAiMessageSeeder, + TSeederImplementation + > GetXAiMessageInMemoryRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiMessage, + Guid, + IXAiMessageKeyGenerator, + XAiMessageKeyGenerator, + IXAiMessageRepositoryEvents, + XAiMessageRepositoryEvents, + XAiMessageGraphType, + GuidGraphType, + XAiMessageGraphQuery, + IXAiMessageGraphQLTypeHelper, + XAiMessageGraphQLTypeHelper, + XAiMessageGraphSchema, + IXAiMessageRepository, + XAiMessageInMemoryRepository, + IXAiMessageSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + #endregion + + // + #region XAiProject ... + // + #region EF Repository Descriptor Provider(s) ... + public static XEFRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectEFRepository, + TContext + > GetXAiProjectEFRepositoryDescriptor() + where TContext : XDbContext + { + // + var result = new XEFRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectEFRepository, + TContext + >(); + + // + return result; + } + + public static XEFRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectEFRepository, + TContext, + IXAiProjectSeeder, + TSeederImplementation + > GetXAiProjectEFRepositoryDescriptor() + where TContext : XDbContext + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XEFRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectEFRepository, + TContext, + IXAiProjectSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region Mongo Repository Descriptor Provider(s) ... + public static XMongoRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectMongoRepository + > GetXAiProjectMongoRepositoryDescriptor() + { + // + var result = new XMongoRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectMongoRepository + >(); + + // + return result; + } + + public static XMongoRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectMongoRepository, + IXAiProjectSeeder, + TSeederImplementation + > GetXAiProjectMongoRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XMongoRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectMongoRepository, + IXAiProjectSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + + // + #region InMemory Repository Descriptor Provider(s) ... + public static XInMemoryRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectInMemoryRepository + > GetXAiProjectInMemoryRepositoryDescriptor() + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectInMemoryRepository + >(); + + // + return result; + } + + public static XInMemoryRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectInMemoryRepository, + IXAiProjectSeeder, + TSeederImplementation + > GetXAiProjectInMemoryRepositoryDescriptor() + where TSeederImplementation : XBaseDbSeeder + { + // + var result = new XInMemoryRepositoryDescriptor< + XAiProject, + Guid, + IXAiProjectKeyGenerator, + XAiProjectKeyGenerator, + IXAiProjectRepositoryEvents, + XAiProjectRepositoryEvents, + XAiProjectGraphType, + GuidGraphType, + XAiProjectGraphQuery, + IXAiProjectGraphQLTypeHelper, + XAiProjectGraphQLTypeHelper, + XAiProjectGraphSchema, + IXAiProjectRepository, + XAiProjectInMemoryRepository, + IXAiProjectSeeder, + TSeederImplementation + >(); + + // + return result; + } + #endregion + #endregion + } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationEntityHub.cs b/Interfaces/Entities/IXAiConversationEntityHub.cs new file mode 100644 index 0000000..b914138 --- /dev/null +++ b/Interfaces/Entities/IXAiConversationEntityHub.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationEntityHub : IXBaseEntityHub + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationGraphQLTypeHelper.cs b/Interfaces/Entities/IXAiConversationGraphQLTypeHelper.cs new file mode 100644 index 0000000..3075a93 --- /dev/null +++ b/Interfaces/Entities/IXAiConversationGraphQLTypeHelper.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationGraphQLTypeHelper : IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationKeyGenerator.cs b/Interfaces/Entities/IXAiConversationKeyGenerator.cs new file mode 100644 index 0000000..877b4ce --- /dev/null +++ b/Interfaces/Entities/IXAiConversationKeyGenerator.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationKeyGenerator : IXKeyGenerator + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationRepository.cs b/Interfaces/Entities/IXAiConversationRepository.cs new file mode 100644 index 0000000..c2a4c93 --- /dev/null +++ b/Interfaces/Entities/IXAiConversationRepository.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationRepositoryEvents.cs b/Interfaces/Entities/IXAiConversationRepositoryEvents.cs new file mode 100644 index 0000000..0261c23 --- /dev/null +++ b/Interfaces/Entities/IXAiConversationRepositoryEvents.cs @@ -0,0 +1,8 @@ +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationRepositoryEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationRepositoryProvider.cs b/Interfaces/Entities/IXAiConversationRepositoryProvider.cs new file mode 100644 index 0000000..8029b23 --- /dev/null +++ b/Interfaces/Entities/IXAiConversationRepositoryProvider.cs @@ -0,0 +1,10 @@ +using System; +using xAiModels.Models.Entities; +using xAiModels.Providers.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationRepositoryProvider : IXBaseEntityProvider + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiConversationSeeder.cs b/Interfaces/Entities/IXAiConversationSeeder.cs new file mode 100644 index 0000000..1b4930a --- /dev/null +++ b/Interfaces/Entities/IXAiConversationSeeder.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiConversationSeeder : IXBaseDbSeeder + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageEntityHub.cs b/Interfaces/Entities/IXAiMessageEntityHub.cs new file mode 100644 index 0000000..b4ffa69 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageEntityHub.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageEntityHub : IXBaseEntityHub + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageGraphQLTypeHelper.cs b/Interfaces/Entities/IXAiMessageGraphQLTypeHelper.cs new file mode 100644 index 0000000..ef63326 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageGraphQLTypeHelper.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageGraphQLTypeHelper : IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageKeyGenerator.cs b/Interfaces/Entities/IXAiMessageKeyGenerator.cs new file mode 100644 index 0000000..1ed3422 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageKeyGenerator.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageKeyGenerator : IXKeyGenerator + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageRepository.cs b/Interfaces/Entities/IXAiMessageRepository.cs new file mode 100644 index 0000000..c26a862 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageRepository.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageRepositoryEvents.cs b/Interfaces/Entities/IXAiMessageRepositoryEvents.cs new file mode 100644 index 0000000..0746cb5 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageRepositoryEvents.cs @@ -0,0 +1,8 @@ +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageRepositoryEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageRepositoryProvider.cs b/Interfaces/Entities/IXAiMessageRepositoryProvider.cs new file mode 100644 index 0000000..8ad5a5e --- /dev/null +++ b/Interfaces/Entities/IXAiMessageRepositoryProvider.cs @@ -0,0 +1,10 @@ +using System; +using xAiModels.Models.Entities; +using xAiModels.Providers.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageRepositoryProvider : IXBaseEntityProvider + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiMessageSeeder.cs b/Interfaces/Entities/IXAiMessageSeeder.cs new file mode 100644 index 0000000..324c6d6 --- /dev/null +++ b/Interfaces/Entities/IXAiMessageSeeder.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiMessageSeeder : IXBaseDbSeeder + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectEntityHub.cs b/Interfaces/Entities/IXAiProjectEntityHub.cs new file mode 100644 index 0000000..2bd658a --- /dev/null +++ b/Interfaces/Entities/IXAiProjectEntityHub.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectEntityHub : IXBaseEntityHub + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectGraphQLTypeHelper.cs b/Interfaces/Entities/IXAiProjectGraphQLTypeHelper.cs new file mode 100644 index 0000000..e093f63 --- /dev/null +++ b/Interfaces/Entities/IXAiProjectGraphQLTypeHelper.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectGraphQLTypeHelper : IXBaseGraphQLTypeHelper + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectKeyGenerator.cs b/Interfaces/Entities/IXAiProjectKeyGenerator.cs new file mode 100644 index 0000000..b87f23e --- /dev/null +++ b/Interfaces/Entities/IXAiProjectKeyGenerator.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectKeyGenerator : IXKeyGenerator + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectRepository.cs b/Interfaces/Entities/IXAiProjectRepository.cs new file mode 100644 index 0000000..8f59536 --- /dev/null +++ b/Interfaces/Entities/IXAiProjectRepository.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectRepository : IXBaseRepository + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectRepositoryEvents.cs b/Interfaces/Entities/IXAiProjectRepositoryEvents.cs new file mode 100644 index 0000000..54908ee --- /dev/null +++ b/Interfaces/Entities/IXAiProjectRepositoryEvents.cs @@ -0,0 +1,8 @@ +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectRepositoryEvents : IXBaseRepositoryEvents + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectRepositoryProvider.cs b/Interfaces/Entities/IXAiProjectRepositoryProvider.cs new file mode 100644 index 0000000..06b0536 --- /dev/null +++ b/Interfaces/Entities/IXAiProjectRepositoryProvider.cs @@ -0,0 +1,10 @@ +using System; +using xAiModels.Models.Entities; +using xAiModels.Providers.Entities; +using xPushService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectRepositoryProvider : IXBaseEntityProvider + { } +} \ No newline at end of file diff --git a/Interfaces/Entities/IXAiProjectSeeder.cs b/Interfaces/Entities/IXAiProjectSeeder.cs new file mode 100644 index 0000000..79ad150 --- /dev/null +++ b/Interfaces/Entities/IXAiProjectSeeder.cs @@ -0,0 +1,9 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.Interfaces; + +namespace xAiModels.Interfaces.Entities +{ + public interface IXAiProjectSeeder : IXBaseDbSeeder + { } +} \ No newline at end of file diff --git a/Interfaces/IXAiConversationTitleResourceProvider.cs b/Interfaces/IXAiConversationTitleResourceProvider.cs new file mode 100644 index 0000000..67e2cfe --- /dev/null +++ b/Interfaces/IXAiConversationTitleResourceProvider.cs @@ -0,0 +1,7 @@ +using xStringService.Interfaces; + +namespace xAiModels.Interfaces +{ + public interface IXAiConversationTitleResourceProvider : IXItemResourceProvider + { } +} \ No newline at end of file diff --git a/Interfaces/IXAiProjectDescriptionResourceProvider.cs b/Interfaces/IXAiProjectDescriptionResourceProvider.cs new file mode 100644 index 0000000..76feb6d --- /dev/null +++ b/Interfaces/IXAiProjectDescriptionResourceProvider.cs @@ -0,0 +1,7 @@ +using xStringService.Interfaces; + +namespace xAiModels.Interfaces +{ + public interface IXAiProjectDescriptionResourceProvider : IXItemResourceProvider + { } +} \ No newline at end of file diff --git a/Interfaces/IXAiProjectTitleResourceProvider.cs b/Interfaces/IXAiProjectTitleResourceProvider.cs new file mode 100644 index 0000000..e5ab983 --- /dev/null +++ b/Interfaces/IXAiProjectTitleResourceProvider.cs @@ -0,0 +1,7 @@ +using xStringService.Interfaces; + +namespace xAiModels.Interfaces +{ + public interface IXAiProjectTitleResourceProvider : IXItemResourceProvider + { } +} \ No newline at end of file diff --git a/Models/XAiConversationDto.cs b/Models/Dtos/XAiConversationDto.cs similarity index 58% rename from Models/XAiConversationDto.cs rename to Models/Dtos/XAiConversationDto.cs index 9b0bd62..e45c229 100644 --- a/Models/XAiConversationDto.cs +++ b/Models/Dtos/XAiConversationDto.cs @@ -1,19 +1,24 @@ using System; -using System.Collections.Generic; using xModels.Base; using xModels.Dtos; -namespace xAiModels.Models +namespace xAiModels.Models.Dtos { /// /// Conversation Describe ... /// - public class XAiConversationDto : XBaseDto + public class XAiConversationDto : XBaseGuidIDEntityDto { /// - /// Id of Conversation ... + /// User Identifier ... /// - public Guid Id { get; set; } + /// + public string OwnerId { get; set; } + + /// + /// Owner Info ... + /// + public virtual XPersonDto Owner { get; set; } = null; /// /// Title of Conversation ... @@ -30,26 +35,12 @@ namespace xAiModels.Models /// public DateTime UpdatedAt { get; set; } - /// - /// Messages of Conversation ... - /// - public IEnumerable Messages { get; set; } - - /// - /// User Identifier ... - /// - /// - public string OwnerId { get; set; } - public XPersonDto Owner { get; set; } - /// /// Project ID ... /// - public Guid ProjectId { get; set; } - - /// - /// Project ... - /// - public XAiProjectDto Project { get; set; } + public Guid ProjectId { get; set; } + + public virtual string ProjectTitle { get; set; } = null; + public virtual string ProjectDescription { get; set; } = null; } } \ No newline at end of file diff --git a/Models/Dtos/XAiMessageDto.cs b/Models/Dtos/XAiMessageDto.cs new file mode 100644 index 0000000..e3004e4 --- /dev/null +++ b/Models/Dtos/XAiMessageDto.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using xAiModels.Constants; +using xCommons.Extensions; +using xModels.Base; +using xModels.Dtos; + +namespace xAiModels.Models.Dtos +{ + public class XAiMessageDto : XBaseGuidIDEntityDto + { + /// + /// User Identifier ... + /// + /// + public string OwnerId { get; set; } + + /// + /// Owner Info ... + /// + public virtual XPersonDto Owner { get; set; } = null; + + /// + /// Message of Chat ... + /// + public string Content { get; set; } + + /// + /// Role of Message ... + /// + public XAiChatRole Role { get; set; } + + /// + /// Created Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Updated Time ... + /// + public DateTime UpdatedAt { get; set; } + + /// + /// Conversation Id ... + /// + public Guid ConversationId { get; set; } + + /// + /// Conversation Info ... + /// + public virtual XAiConversationDto Conversation { get; set; } = null; + + // + #region Meta Data Property ... + private string _metadata; + + /// + /// Meta Data of Message ... + /// + public IDictionary Metadata { get; private set; } = null; + + /// + /// Meta Data of MEssage in Json ... + /// + public string MeatDatas + { + // + get => _metadata; + + // + set + { + // + // Converts Json String to Dictionary ... + if (!value.IsNullOrEmpty()) + { + Metadata = value.FromJSON>(); + } + + // + _metadata = value; + } + } + #endregion + } +} \ No newline at end of file diff --git a/Models/XAiProjectDto.cs b/Models/Dtos/XAiProjectDto.cs similarity index 75% rename from Models/XAiProjectDto.cs rename to Models/Dtos/XAiProjectDto.cs index 56cf706..8e0b697 100644 --- a/Models/XAiProjectDto.cs +++ b/Models/Dtos/XAiProjectDto.cs @@ -3,17 +3,23 @@ using System.Collections.Generic; using xModels.Base; using xModels.Dtos; -namespace xAiModels.Models +namespace xAiModels.Models.Dtos { /// - /// an Ai Project is a Conceptual Separation of AI Conversations ... + /// Describe a Project ... /// - public class XAiProjectDto : XBaseDto + public class XAiProjectDto : XBaseGuidIDEntityDto { /// - /// Id of Project ... + /// User Identifier ... /// - public Guid Id { get; set; } + /// + public string OwnerId { get; set; } + + /// + /// Owner Info ... + /// + public virtual XPersonDto Owner { get; set; } = null; /// /// Title of Project ... @@ -40,16 +46,9 @@ namespace xAiModels.Models /// public DateTime UpdatedAt { get; set; } - /// - /// User Identifier ... - /// - /// - public string OwnerId { get; set; } - public XPersonDto Owner { get; set; } - /// /// Conversations ... /// - public IEnumerable Conversations { get; set; } + public virtual IList Conversations { get; set; } = []; } } \ No newline at end of file diff --git a/Models/Entities/XAiConversation.cs b/Models/Entities/XAiConversation.cs new file mode 100644 index 0000000..4aca751 --- /dev/null +++ b/Models/Entities/XAiConversation.cs @@ -0,0 +1,43 @@ +using System; +using System.ComponentModel.DataAnnotations; +using xModels.Base; + +namespace xAiModels.Models.Entities +{ + /// + /// Conversation Describe ... + /// + public class XAiConversation : XBaseGuidIDEntity + { + /// + /// User Identifier ... + /// + /// + [Required] + [StringLength(255)] + public string OwnerId { get; set; } + + /// + /// Title of Conversation ... + /// + [Required] + [StringLength(255)] + public string Title { get; set; } + + /// + /// Created Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Updated Time ... + /// + public DateTime UpdatedAt { get; set; } + + /// + /// Project ID ... + /// + [Required] + public Guid ProjectId { get; set; } + } +} \ No newline at end of file diff --git a/Models/Entities/XAiMessage.cs b/Models/Entities/XAiMessage.cs new file mode 100644 index 0000000..547ccd6 --- /dev/null +++ b/Models/Entities/XAiMessage.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using xAiModels.Constants; +using xCommons.Extensions; +using xModels.Base; + +namespace xAiModels.Models.Entities +{ + /// + /// Message Model of Ai ... + /// + public class XAiMessage : XBaseGuidIDEntity + { + /// + /// User Identifier ... + /// + /// + [Required] + [StringLength(255)] + public string OwnerId { get; set; } + + /// + /// Message of Chat ... + /// + [Required] + public string Content { get; set; } + + /// + /// Role of Message ... + /// + public XAiChatRole Role { get; set; } + + /// + /// Created Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Updated Time ... + /// + public DateTime UpdatedAt { get; set; } + + /// + /// Conversation Id ... + /// + [StringLength(255)] + public Guid ConversationId { get; set; } + + // + #region Meta Data Property ... + private string _metadata; + + /// + /// Meta Data of Message ... + /// + [NotMapped] + public IDictionary Metadata { get; private set; } = null; + + /// + /// Meta Data of MEssage in Json ... + /// + public string MeatDatas + { + // + get => _metadata; + + // + set + { + // + // Converts Json String to Dictionary ... + if (!value.IsNullOrEmpty()) + { + Metadata = value.FromJSON>(); + } + + // + _metadata = value; + } + } + #endregion + } +} \ No newline at end of file diff --git a/Models/Entities/XAiProject.cs b/Models/Entities/XAiProject.cs new file mode 100644 index 0000000..1edacbd --- /dev/null +++ b/Models/Entities/XAiProject.cs @@ -0,0 +1,48 @@ +using System; +using System.ComponentModel.DataAnnotations; +using xModels.Base; + +namespace xAiModels.Models.Entities +{ + /// + /// Describe a Project ... + /// + public class XAiProject : XBaseGuidIDEntity + { + /// + /// User Identifier ... + /// + /// + [Required] + [StringLength(255)] + public string OwnerId { get; set; } + + /// + /// Title of Project ... + /// + [Required] + [StringLength(255)] + public string Title { get; set; } + + /// + /// Description of Project ... + /// + [StringLength(1000)] + public string Description { get; set; } + + /// + /// a Prompt for Project Start ... + /// + public string Prompt { get; set; } + + /// + /// Created Time ... + /// + public DateTime CreatedOn { get; set; } + + /// + /// Updated Time ... + /// + public DateTime UpdatedAt { get; set; } + } +} \ No newline at end of file diff --git a/Models/XAiMessageDto.cs b/Models/XAiMessageDto.cs deleted file mode 100644 index d4eb29a..0000000 --- a/Models/XAiMessageDto.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using xAiModels.Constants; -using xModels.Base; -using xModels.Dtos; - -namespace xAiModels.Models -{ - /// - /// Message Model of Ai ... - /// - public class XAiMessageDto : XBaseDto - { - /// - /// Id of Message ... - /// - public Guid Id { get; set; } - - /// - /// Message of Chat ... - /// - public string Content { get; set; } - - /// - /// Role of Message ... - /// - public XAiChatRole Role { get; set; } - - /// - /// Created Time ... - /// - public DateTime CreatedOn { get; set; } - - /// - /// Updated Time ... - /// - public DateTime UpdatedAt { get; set; } - - /// - /// User Identifier ... - /// - /// - public string OwnerId { get; set; } - public XPersonDto Owner { get; set; } - - /// - /// Conversation Id ... - /// - public Guid ConversationId { get; set; } - - /// - /// Conversation ... - /// - public XAiConversationDto Conversation { get; set; } - } -} \ No newline at end of file diff --git a/Models/XAiMessageUpdateDto.cs b/Models/XAiMessageUpdateDto.cs deleted file mode 100644 index 5983da3..0000000 --- a/Models/XAiMessageUpdateDto.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using xAiModels.Constants; -using xModels.Base; - -namespace xAiModels.Models -{ - public class XAiMessageUpdateDto : XBaseDto - { - /// - /// Message Sequence ... - /// - public long Sequense { get; set; } - - /// - /// Id of Message ... - /// - public Guid Id { get; set; } - - /// - /// Message of Chat ... - /// - public string Content { get; set; } - - /// - /// Role of Message ... - /// - public XAiChatRole Role { get; set; } - - /// - /// Updated Time ... - /// - public DateTime UpdatedAt { get; set; } - - /// - /// User Identifier ... - /// - /// - public string OwnerId { get; set; } - - /// - /// Conversation Id ... - /// - public Guid ConversationId { get; set; } - } -} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationEFRepository.cs b/Providers/Entities/XAiConversationEFRepository.cs new file mode 100644 index 0000000..944c54b --- /dev/null +++ b/Providers/Entities/XAiConversationEFRepository.cs @@ -0,0 +1,27 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Db; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationEFRepository : XBaseEFRepository, IXAiConversationRepository + where TContext : XDbContext + { + public XAiConversationEFRepository( + IXUnitOfWorks unitOfWorks, + XDataServiceConfiguration configuration, + IXAiConversationKeyGenerator keyGenerator = null, + IXAiConversationRepositoryEvents baseRepositoryEvents = null + ) : base( + unitOfWorks, + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationEntityHub.cs b/Providers/Entities/XAiConversationEntityHub.cs new file mode 100644 index 0000000..2291f25 --- /dev/null +++ b/Providers/Entities/XAiConversationEntityHub.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Extensions.Logging; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationEntityHub : XBaseEntityHub, IXAiConversationEntityHub + { + public XAiConversationEntityHub( + ILogger logger + ) : base(logger) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationInMemoryRepository.cs b/Providers/Entities/XAiConversationInMemoryRepository.cs new file mode 100644 index 0000000..15a85b0 --- /dev/null +++ b/Providers/Entities/XAiConversationInMemoryRepository.cs @@ -0,0 +1,22 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationInMemoryRepository : XBaseInMemoryRepository, IXAiConversationRepository + { + public XAiConversationInMemoryRepository( + XDataServiceConfiguration configuration, + IXAiConversationKeyGenerator keyGenerator = null, + IXAiConversationRepositoryEvents baseRepositoryEvents = null + ) : base( + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationKeyGenerator.cs b/Providers/Entities/XAiConversationKeyGenerator.cs new file mode 100644 index 0000000..d754425 --- /dev/null +++ b/Providers/Entities/XAiConversationKeyGenerator.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationKeyGenerator : XGuidKeyGenerator, IXAiConversationKeyGenerator + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationMongoRepository.cs b/Providers/Entities/XAiConversationMongoRepository.cs new file mode 100644 index 0000000..881e217 --- /dev/null +++ b/Providers/Entities/XAiConversationMongoRepository.cs @@ -0,0 +1,26 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationMongoRepository : XBaseMongoRepository, IXAiConversationRepository + { + public XAiConversationMongoRepository( + XDataBaseConfiguration dbConfiguration, + XDataServiceConfiguration configuration, + string collectionName = null, + IXAiConversationKeyGenerator keyGenerator = null, + IXAiConversationRepositoryEvents baseRepositoryEvents = null + ) : base( + dbConfiguration, + configuration, + collectionName, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationRepositoryEvents.cs b/Providers/Entities/XAiConversationRepositoryEvents.cs new file mode 100644 index 0000000..bae3cef --- /dev/null +++ b/Providers/Entities/XAiConversationRepositoryEvents.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationRepositoryEvents : XBaseRepositoryEvents, IXAiConversationRepositoryEvents + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationRepositoryProvider.cs b/Providers/Entities/XAiConversationRepositoryProvider.cs new file mode 100644 index 0000000..5015227 --- /dev/null +++ b/Providers/Entities/XAiConversationRepositoryProvider.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.AspNetCore.SignalR; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xIdentityService.Interfaces; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiConversationRepositoryProvider : XBaseEntityProvider, IXAiConversationRepositoryProvider + { + public XAiConversationRepositoryProvider( + IHubContext hub, + IXAiConversationRepository repository, + XDataServiceConfiguration dataConfiguration, + IXIdentityProvider identityProvider = null + ) : base( + hub, + repository, + dataConfiguration, + identityProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiConversationSeederBase.cs b/Providers/Entities/XAiConversationSeederBase.cs new file mode 100644 index 0000000..d610be4 --- /dev/null +++ b/Providers/Entities/XAiConversationSeederBase.cs @@ -0,0 +1,24 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public abstract class XAiConversationSeederBase : XBaseDbSeeder, IXAiConversationSeeder + { + protected XAiConversationSeederBase( + string entity, + string database, + IXAiConversationRepository repository, + XDataServiceConfiguration dataServiceConfiguration + ) : base( + entity, + database, + repository, + dataServiceConfiguration + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageEFRepository.cs b/Providers/Entities/XAiMessageEFRepository.cs new file mode 100644 index 0000000..078a535 --- /dev/null +++ b/Providers/Entities/XAiMessageEFRepository.cs @@ -0,0 +1,27 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Db; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageEFRepository : XBaseEFRepository, IXAiMessageRepository + where TContext : XDbContext + { + public XAiMessageEFRepository( + IXUnitOfWorks unitOfWorks, + XDataServiceConfiguration configuration, + IXAiMessageKeyGenerator keyGenerator = null, + IXAiMessageRepositoryEvents baseRepositoryEvents = null + ) : base( + unitOfWorks, + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageEntityHub.cs b/Providers/Entities/XAiMessageEntityHub.cs new file mode 100644 index 0000000..64415ac --- /dev/null +++ b/Providers/Entities/XAiMessageEntityHub.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Extensions.Logging; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageEntityHub : XBaseEntityHub, IXAiMessageEntityHub + { + public XAiMessageEntityHub( + ILogger logger + ) : base(logger) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageInMemoryRepository.cs b/Providers/Entities/XAiMessageInMemoryRepository.cs new file mode 100644 index 0000000..079f9a8 --- /dev/null +++ b/Providers/Entities/XAiMessageInMemoryRepository.cs @@ -0,0 +1,22 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageInMemoryRepository : XBaseInMemoryRepository, IXAiMessageRepository + { + public XAiMessageInMemoryRepository( + XDataServiceConfiguration configuration, + IXAiMessageKeyGenerator keyGenerator = null, + IXAiMessageRepositoryEvents baseRepositoryEvents = null + ) : base( + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageKeyGenerator.cs b/Providers/Entities/XAiMessageKeyGenerator.cs new file mode 100644 index 0000000..8597ca5 --- /dev/null +++ b/Providers/Entities/XAiMessageKeyGenerator.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageKeyGenerator : XGuidKeyGenerator, IXAiMessageKeyGenerator + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageMongoRepository.cs b/Providers/Entities/XAiMessageMongoRepository.cs new file mode 100644 index 0000000..523bbbd --- /dev/null +++ b/Providers/Entities/XAiMessageMongoRepository.cs @@ -0,0 +1,26 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageMongoRepository : XBaseMongoRepository, IXAiMessageRepository + { + public XAiMessageMongoRepository( + XDataBaseConfiguration dbConfiguration, + XDataServiceConfiguration configuration, + string collectionName = null, + IXAiMessageKeyGenerator keyGenerator = null, + IXAiMessageRepositoryEvents baseRepositoryEvents = null + ) : base( + dbConfiguration, + configuration, + collectionName, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageRepositoryEvents.cs b/Providers/Entities/XAiMessageRepositoryEvents.cs new file mode 100644 index 0000000..fb5a1b5 --- /dev/null +++ b/Providers/Entities/XAiMessageRepositoryEvents.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageRepositoryEvents : XBaseRepositoryEvents, IXAiMessageRepositoryEvents + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageRepositoryProvider.cs b/Providers/Entities/XAiMessageRepositoryProvider.cs new file mode 100644 index 0000000..d729ffd --- /dev/null +++ b/Providers/Entities/XAiMessageRepositoryProvider.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.AspNetCore.SignalR; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xIdentityService.Interfaces; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiMessageRepositoryProvider : XBaseEntityProvider, IXAiMessageRepositoryProvider + { + public XAiMessageRepositoryProvider( + IHubContext hub, + IXAiMessageRepository repository, + XDataServiceConfiguration dataConfiguration, + IXIdentityProvider identityProvider = null + ) : base( + hub, + repository, + dataConfiguration, + identityProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiMessageSeederBase.cs b/Providers/Entities/XAiMessageSeederBase.cs new file mode 100644 index 0000000..0778458 --- /dev/null +++ b/Providers/Entities/XAiMessageSeederBase.cs @@ -0,0 +1,24 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public abstract class XAiMessageSeederBase : XBaseDbSeeder, IXAiMessageSeeder + { + protected XAiMessageSeederBase( + string entity, + string database, + IXAiMessageRepository repository, + XDataServiceConfiguration dataServiceConfiguration + ) : base( + entity, + database, + repository, + dataServiceConfiguration + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectEFRepository.cs b/Providers/Entities/XAiProjectEFRepository.cs new file mode 100644 index 0000000..af98eb4 --- /dev/null +++ b/Providers/Entities/XAiProjectEFRepository.cs @@ -0,0 +1,27 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Db; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectEFRepository : XBaseEFRepository, IXAiProjectRepository + where TContext : XDbContext + { + public XAiProjectEFRepository( + IXUnitOfWorks unitOfWorks, + XDataServiceConfiguration configuration, + IXAiProjectKeyGenerator keyGenerator = null, + IXAiProjectRepositoryEvents baseRepositoryEvents = null + ) : base( + unitOfWorks, + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectEntityHub.cs b/Providers/Entities/XAiProjectEntityHub.cs new file mode 100644 index 0000000..f3bbf39 --- /dev/null +++ b/Providers/Entities/XAiProjectEntityHub.cs @@ -0,0 +1,16 @@ +using System; +using Microsoft.Extensions.Logging; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectEntityHub : XBaseEntityHub, IXAiProjectEntityHub + { + public XAiProjectEntityHub( + ILogger logger + ) : base(logger) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectInMemoryRepository.cs b/Providers/Entities/XAiProjectInMemoryRepository.cs new file mode 100644 index 0000000..982326b --- /dev/null +++ b/Providers/Entities/XAiProjectInMemoryRepository.cs @@ -0,0 +1,22 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectInMemoryRepository : XBaseInMemoryRepository, IXAiProjectRepository + { + public XAiProjectInMemoryRepository( + XDataServiceConfiguration configuration, + IXAiProjectKeyGenerator keyGenerator = null, + IXAiProjectRepositoryEvents baseRepositoryEvents = null + ) : base( + configuration, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectKeyGenerator.cs b/Providers/Entities/XAiProjectKeyGenerator.cs new file mode 100644 index 0000000..d0fea08 --- /dev/null +++ b/Providers/Entities/XAiProjectKeyGenerator.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectKeyGenerator : XGuidKeyGenerator, IXAiProjectKeyGenerator + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectMongoRepository.cs b/Providers/Entities/XAiProjectMongoRepository.cs new file mode 100644 index 0000000..c22efbb --- /dev/null +++ b/Providers/Entities/XAiProjectMongoRepository.cs @@ -0,0 +1,26 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectMongoRepository : XBaseMongoRepository, IXAiProjectRepository + { + public XAiProjectMongoRepository( + XDataBaseConfiguration dbConfiguration, + XDataServiceConfiguration configuration, + string collectionName = null, + IXAiProjectKeyGenerator keyGenerator = null, + IXAiProjectRepositoryEvents baseRepositoryEvents = null + ) : base( + dbConfiguration, + configuration, + collectionName, + keyGenerator, + baseRepositoryEvents + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectRepositoryEvents.cs b/Providers/Entities/XAiProjectRepositoryEvents.cs new file mode 100644 index 0000000..2fdecc7 --- /dev/null +++ b/Providers/Entities/XAiProjectRepositoryEvents.cs @@ -0,0 +1,9 @@ +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectRepositoryEvents : XBaseRepositoryEvents, IXAiProjectRepositoryEvents + { } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectRepositoryProvider.cs b/Providers/Entities/XAiProjectRepositoryProvider.cs new file mode 100644 index 0000000..4aa479d --- /dev/null +++ b/Providers/Entities/XAiProjectRepositoryProvider.cs @@ -0,0 +1,26 @@ +using System; +using Microsoft.AspNetCore.SignalR; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xIdentityService.Interfaces; +using xPushService.Base; + +namespace xAiModels.Providers.Entities +{ + public class XAiProjectRepositoryProvider : XBaseEntityProvider, IXAiProjectRepositoryProvider + { + public XAiProjectRepositoryProvider( + IHubContext hub, + IXAiProjectRepository repository, + XDataServiceConfiguration dataConfiguration, + IXIdentityProvider identityProvider = null + ) : base( + hub, + repository, + dataConfiguration, + identityProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/Entities/XAiProjectSeederBase.cs b/Providers/Entities/XAiProjectSeederBase.cs new file mode 100644 index 0000000..0fac332 --- /dev/null +++ b/Providers/Entities/XAiProjectSeederBase.cs @@ -0,0 +1,24 @@ +using System; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.Providers; + +namespace xAiModels.Providers.Entities +{ + public abstract class XAiProjectSeederBase : XBaseDbSeeder, IXAiProjectSeeder + { + protected XAiProjectSeederBase( + string entity, + string database, + IXAiProjectRepository repository, + XDataServiceConfiguration dataServiceConfiguration + ) : base( + entity, + database, + repository, + dataServiceConfiguration + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiConversationGraphQLTypeHelper.cs b/Providers/GraphQL/XAiConversationGraphQLTypeHelper.cs new file mode 100644 index 0000000..9d2ee96 --- /dev/null +++ b/Providers/GraphQL/XAiConversationGraphQLTypeHelper.cs @@ -0,0 +1,21 @@ +using System; +using xAiModels.Constants; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiConversationGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiConversationGraphQLTypeHelper + { + public override string GetInQueryCollectionName() + { + return XAiModelsConstants.XAiConversationCollectionName; + } + + public override string GetInQuerySingleName() + { + return XAiModelsConstants.XAiConversationSignleName; + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiConversationGraphQuery.cs b/Providers/GraphQL/XAiConversationGraphQuery.cs new file mode 100644 index 0000000..a4b1871 --- /dev/null +++ b/Providers/GraphQL/XAiConversationGraphQuery.cs @@ -0,0 +1,23 @@ +using System; +using GraphQL.Types; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiConversationGraphQuery : XBaseGraphQLQuery + { + public XAiConversationGraphQuery( + XDataServiceConfiguration configuration, + IXAiConversationRepository repository, + IXAiConversationGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiConversationGraphSchema.cs b/Providers/GraphQL/XAiConversationGraphSchema.cs new file mode 100644 index 0000000..f757efb --- /dev/null +++ b/Providers/GraphQL/XAiConversationGraphSchema.cs @@ -0,0 +1,13 @@ +using System; +using GraphQL.Types; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiConversationGraphSchema : Schema + { + public XAiConversationGraphSchema(IServiceProvider services) : base(services) + { + Query = (XAiConversationGraphQuery)services.GetService(typeof(XAiConversationGraphQuery)); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiConversationGraphType.cs b/Providers/GraphQL/XAiConversationGraphType.cs new file mode 100644 index 0000000..f6a4696 --- /dev/null +++ b/Providers/GraphQL/XAiConversationGraphType.cs @@ -0,0 +1,18 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiConversationGraphType : XBaseGraphObjectType + { + public XAiConversationGraphType() : base() + { + Field(x => x.Title); + Field(x => x.OwnerId); + Field(x => x.CreatedOn); + Field(x => x.UpdatedAt); + Field(x => x.ProjectId); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiMessageGraphQLTypeHelper.cs b/Providers/GraphQL/XAiMessageGraphQLTypeHelper.cs new file mode 100644 index 0000000..85a12bb --- /dev/null +++ b/Providers/GraphQL/XAiMessageGraphQLTypeHelper.cs @@ -0,0 +1,21 @@ +using System; +using xAiModels.Constants; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiMessageGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiMessageGraphQLTypeHelper + { + public override string GetInQueryCollectionName() + { + return XAiModelsConstants.XAiMessageCollectionName; + } + + public override string GetInQuerySingleName() + { + return XAiModelsConstants.XAiMessageSingleName; + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiMessageGraphQuery.cs b/Providers/GraphQL/XAiMessageGraphQuery.cs new file mode 100644 index 0000000..3348339 --- /dev/null +++ b/Providers/GraphQL/XAiMessageGraphQuery.cs @@ -0,0 +1,23 @@ +using System; +using GraphQL.Types; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiMessageGraphQuery : XBaseGraphQLQuery + { + public XAiMessageGraphQuery( + XDataServiceConfiguration configuration, + IXAiMessageRepository repository, + IXAiMessageGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiMessageGraphSchema.cs b/Providers/GraphQL/XAiMessageGraphSchema.cs new file mode 100644 index 0000000..84ce43a --- /dev/null +++ b/Providers/GraphQL/XAiMessageGraphSchema.cs @@ -0,0 +1,13 @@ +using System; +using GraphQL.Types; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiMessageGraphSchema : Schema + { + public XAiMessageGraphSchema(IServiceProvider services) : base(services) + { + Query = (XAiMessageGraphQuery)services.GetService(typeof(XAiMessageGraphQuery)); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiMessageGraphType.cs b/Providers/GraphQL/XAiMessageGraphType.cs new file mode 100644 index 0000000..79a0fca --- /dev/null +++ b/Providers/GraphQL/XAiMessageGraphType.cs @@ -0,0 +1,20 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiMessageGraphType: XBaseGraphObjectType + { + public XAiMessageGraphType() : base() + { + Field(x => x.Role); + Field(x => x.OwnerId); + Field(x => x.Content); + Field(x => x.Metadata); + Field(x => x.CreatedOn); + Field(x => x.UpdatedAt); + Field(x => x.ConversationId); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiProjectGraphQLTypeHelper.cs b/Providers/GraphQL/XAiProjectGraphQLTypeHelper.cs new file mode 100644 index 0000000..21b0282 --- /dev/null +++ b/Providers/GraphQL/XAiProjectGraphQLTypeHelper.cs @@ -0,0 +1,21 @@ +using System; +using xAiModels.Constants; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiProjectGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiProjectGraphQLTypeHelper + { + public override string GetInQueryCollectionName() + { + return XAiModelsConstants.XAiProjectCollectionName; + } + + public override string GetInQuerySingleName() + { + return XAiModelsConstants.XAiProjectSingleName; + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiProjectGraphQuery.cs b/Providers/GraphQL/XAiProjectGraphQuery.cs new file mode 100644 index 0000000..c806ac4 --- /dev/null +++ b/Providers/GraphQL/XAiProjectGraphQuery.cs @@ -0,0 +1,23 @@ +using System; +using GraphQL.Types; +using xAiModels.Interfaces.Entities; +using xAiModels.Models.Entities; +using xDataService.Configuration; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiProjectGraphQuery : XBaseGraphQLQuery + { + public XAiProjectGraphQuery( + XDataServiceConfiguration configuration, + IXAiProjectRepository repository, + IXAiProjectGraphQLTypeHelper helper + ) : base( + configuration, + repository, + helper + ) + { } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiProjectGraphSchema.cs b/Providers/GraphQL/XAiProjectGraphSchema.cs new file mode 100644 index 0000000..9dcca5b --- /dev/null +++ b/Providers/GraphQL/XAiProjectGraphSchema.cs @@ -0,0 +1,13 @@ +using System; +using GraphQL.Types; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiProjectGraphSchema : Schema + { + public XAiProjectGraphSchema(IServiceProvider services) : base(services) + { + Query = (XAiProjectGraphQuery)services.GetService(typeof(XAiProjectGraphQuery)); + } + } +} \ No newline at end of file diff --git a/Providers/GraphQL/XAiProjectGraphType.cs b/Providers/GraphQL/XAiProjectGraphType.cs new file mode 100644 index 0000000..2d38178 --- /dev/null +++ b/Providers/GraphQL/XAiProjectGraphType.cs @@ -0,0 +1,19 @@ +using System; +using xAiModels.Models.Entities; +using xDataService.GraphQL; + +namespace xAiModels.Providers.GraphQL +{ + public class XAiProjectGraphType : XBaseGraphObjectType + { + public XAiProjectGraphType() : base() + { + Field(x => x.Title); + Field(x => x.OwnerId); + Field(x => x.Prompt); + Field(x => x.CreatedOn); + Field(x => x.UpdatedAt); + Field(x => x.Description); + } + } +} \ No newline at end of file diff --git a/Providers/XAiConversationEntityRegisterar.cs b/Providers/XAiConversationEntityRegisterar.cs new file mode 100644 index 0000000..b7aa9bd --- /dev/null +++ b/Providers/XAiConversationEntityRegisterar.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore; +using xAiModels.Configurations.Entities; +using xAiModels.Models.Entities; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers +{ + public class XAiConversationEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar + { + public XAiConversationEntityRegisterar() + : base(nameof(XAiConversationEntityRegisterar)) + { + // + // Add Entity ... + AddEntity(); + } + + /// + /// Configure Entities ... + /// + /// + public override void ConfigureEntities(ModelBuilder modelBuilder) + { + // + // Configure Entity Using Provided ... + modelBuilder + .ApplyConfigurationsFromAssembly(typeof(XAiConversationEntityConfiguration).Assembly); + + // + base.ConfigureEntities(modelBuilder); + } + } +} \ No newline at end of file diff --git a/Providers/XAiConversationTitleResourceProvider.cs b/Providers/XAiConversationTitleResourceProvider.cs new file mode 100644 index 0000000..0a44ddf --- /dev/null +++ b/Providers/XAiConversationTitleResourceProvider.cs @@ -0,0 +1,18 @@ +using xAiModels.Constants; +using xAiModels.Interfaces; +using xStringService.Interfaces.Dtos; +using xStringService.Providers; + +namespace xAiModels.Providers +{ + public class XAiConversationTitleResourceProvider : XBaseItemResourceProvider, IXAiConversationTitleResourceProvider + { + public XAiConversationTitleResourceProvider( + IXStringServiceProvider stringProvider + ) : base( + item: XAiModelsConstants.XAiConversationTitleIdentifier, + stringProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XAiMessageEntityRegisterar.cs b/Providers/XAiMessageEntityRegisterar.cs new file mode 100644 index 0000000..6880d25 --- /dev/null +++ b/Providers/XAiMessageEntityRegisterar.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore; +using xAiModels.Configurations.Entities; +using xAiModels.Models.Entities; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers +{ + public class XAiMessageEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar + { + public XAiMessageEntityRegisterar() + : base(nameof(XAiMessageEntityRegisterar)) + { + // + // Add Entity ... + AddEntity(); + } + + /// + /// Configure Entities ... + /// + /// + public override void ConfigureEntities(ModelBuilder modelBuilder) + { + // + // Configure Entity Using Provided ... + modelBuilder + .ApplyConfigurationsFromAssembly(typeof(XAiMessageEntityConfiguration).Assembly); + + // + base.ConfigureEntities(modelBuilder); + } + } +} \ No newline at end of file diff --git a/Providers/XAiProjectDescriptionResourceProvider.cs b/Providers/XAiProjectDescriptionResourceProvider.cs new file mode 100644 index 0000000..c884d60 --- /dev/null +++ b/Providers/XAiProjectDescriptionResourceProvider.cs @@ -0,0 +1,18 @@ +using xAiModels.Constants; +using xAiModels.Interfaces; +using xStringService.Interfaces.Dtos; +using xStringService.Providers; + +namespace xAiModels.Providers +{ + public class XAiProjectDescriptionResourceProvider : XBaseItemResourceProvider, IXAiProjectDescriptionResourceProvider + { + public XAiProjectDescriptionResourceProvider( + IXStringServiceProvider stringProvider + ) : base( + item: XAiModelsConstants.XAiProjectDescriptionIdentifier, + stringProvider + ) + { } + } +} \ No newline at end of file diff --git a/Providers/XAiProjectEntityRegisterar.cs b/Providers/XAiProjectEntityRegisterar.cs new file mode 100644 index 0000000..88ed11c --- /dev/null +++ b/Providers/XAiProjectEntityRegisterar.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.EntityFrameworkCore; +using xAiModels.Configurations.Entities; +using xAiModels.Models.Entities; +using xDataService.Interfaces; +using xDataService.Providers; + +namespace xAiModels.Providers +{ + public class XAiProjectEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar + { + public XAiProjectEntityRegisterar() + : base(nameof(XAiProjectEntityRegisterar)) + { + // + // Add Entity ... + AddEntity(); + } + + /// + /// Configure Entities ... + /// + /// + public override void ConfigureEntities(ModelBuilder modelBuilder) + { + // + // Configure Entity Using Provided ... + modelBuilder + .ApplyConfigurationsFromAssembly(typeof(XAiProjectEntityConfiguration).Assembly); + + // + base.ConfigureEntities(modelBuilder); + } + } +} \ No newline at end of file diff --git a/Providers/XAiProjectTitleResourceProvider.cs b/Providers/XAiProjectTitleResourceProvider.cs new file mode 100644 index 0000000..be2e4f7 --- /dev/null +++ b/Providers/XAiProjectTitleResourceProvider.cs @@ -0,0 +1,18 @@ +using xAiModels.Constants; +using xAiModels.Interfaces; +using xStringService.Interfaces.Dtos; +using xStringService.Providers; + +namespace xAiModels.Providers +{ + public class XAiProjectTitleResourceProvider : XBaseItemResourceProvider, IXAiProjectTitleResourceProvider + { + public XAiProjectTitleResourceProvider( + IXStringServiceProvider stringProvider + ) : base( + item: XAiModelsConstants.XAiProjectTitleIdentifier, + stringProvider + ) + { } + } +} \ No newline at end of file diff --git a/nuget.config b/nuget.config index 184cdea..c6fd40c 100644 --- a/nuget.config +++ b/nuget.config @@ -3,6 +3,6 @@ - + \ No newline at end of file diff --git a/xAiModels.csproj b/xAiModels.csproj index 1fd2edf..e3be5ed 100644 --- a/xAiModels.csproj +++ b/xAiModels.csproj @@ -1,13 +1,17 @@ + - netstandard2.0 - xSaherelm.xAiModels 1.0.0 + 12.0 Hadi Khazaee Asl SaherElm IT Center + xSaherelm.xAiModels + netstandard2.0 + - it is a Part of xSaherElm project which Provides all Models which used in Ai Service ... + it is a Part of xSaherElm project which Provides all Models and Data Service + Implementations which used in Ai Service ... @@ -22,14 +26,24 @@ - - - + - + - - + + + + + + + + + + true + true + $(NoWarn);1591 + + \ No newline at end of file