last ...
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
using System;
|
||||
using GraphQL.Server;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using xAiApi.AI.DataHelper.GraphQL;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xAiApi.Data.GraphQL;
|
||||
using xAiApi.Data.Interfaces;
|
||||
using xAiApi.Data.Models.Entities;
|
||||
@@ -24,6 +28,21 @@ namespace xAiApi.Data.Helpers
|
||||
// XTest ...
|
||||
services.AddSingleton<XTestGraphType>();
|
||||
services.AddSingleton<XBaseGraphQLEventType<XTest, int, XTestGraphType>>();
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
services.AddSingleton<XAiMessageGraphType>();
|
||||
services.AddSingleton<XBaseGraphQLEventType<XAiMessage, Guid, XAiMessageGraphType>>();
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
services.AddSingleton<XAiProjectGraphType>();
|
||||
services.AddSingleton<XBaseGraphQLEventType<XAiProject, Guid, XAiProjectGraphType>>();
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
services.AddSingleton<XAiConversationGraphType>();
|
||||
services.AddSingleton<XBaseGraphQLEventType<XAiConversation, Guid, XAiConversationGraphType>>();
|
||||
}
|
||||
|
||||
public void AddXGraphQueries(IServiceCollection services)
|
||||
@@ -32,12 +51,30 @@ namespace xAiApi.Data.Helpers
|
||||
// XTest ...
|
||||
services.AddSingleton<IXTestGraphQLTypeHelper, XTestGraphQLTypeHelper>();
|
||||
services.AddScoped<XTestGraphQuery>();
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
services.AddSingleton<IXAiMessageGraphQLTypeHelper, XAiMessageGraphQLTypeHelper>();
|
||||
services.AddScoped<XAiMessageGraphQuery>();
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
services.AddSingleton<IXAiProjectGraphQLTypeHelper, XAiProjectGraphQLTypeHelper>();
|
||||
services.AddScoped<XAiProjectGraphQuery>();
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
services.AddSingleton<IXAiConversationGraphQLTypeHelper, XAiConversationGraphQLTypeHelper>();
|
||||
services.AddScoped<XAiConversationGraphQuery>();
|
||||
}
|
||||
|
||||
public void AddXGraphSchemas(IServiceCollection services)
|
||||
{
|
||||
//
|
||||
services.AddScoped<XTestGraphSchema>();
|
||||
services.AddScoped<XAiMessageGraphSchema>();
|
||||
services.AddScoped<XAiProjectGraphSchema>();
|
||||
services.AddScoped<XAiConversationGraphSchema>();
|
||||
}
|
||||
|
||||
public void AddXGraphSubscriptions(IServiceCollection services) { }
|
||||
@@ -65,6 +102,24 @@ namespace xAiApi.Data.Helpers
|
||||
var testHelper = scope.ServiceProvider.GetService<IXTestGraphQLTypeHelper>();
|
||||
app.UseGraphQL<XTestGraphSchema>(testHelper.GetGraphQLPath());
|
||||
app.UseGraphQLWebSockets<XTestGraphSchema>();
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
var aiMessageHelper = scope.ServiceProvider.GetService<IXAiMessageGraphQLTypeHelper>();
|
||||
app.UseGraphQL<XAiMessageGraphSchema>(aiMessageHelper.GetGraphQLPath());
|
||||
app.UseGraphQLWebSockets<XAiMessageGraphSchema>();
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
var aiProjectHelper = scope.ServiceProvider.GetService<IXAiProjectGraphQLTypeHelper>();
|
||||
app.UseGraphQL<XAiProjectGraphSchema>(aiProjectHelper.GetGraphQLPath());
|
||||
app.UseGraphQLWebSockets<XAiProjectGraphSchema>();
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
var aiConversationHelper = scope.ServiceProvider.GetService<IXAiConversationGraphQLTypeHelper>();
|
||||
app.UseGraphQL<XAiConversationGraphSchema>(aiConversationHelper.GetGraphQLPath());
|
||||
app.UseGraphQLWebSockets<XAiConversationGraphSchema>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoDB.Bson.Serialization.Conventions;
|
||||
using xAiApi.AI.DataHelper.Events;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xAiApi.Data.Events;
|
||||
using xAiApi.Data.Extensions;
|
||||
using xAiApi.Data.Interfaces;
|
||||
@@ -105,6 +108,18 @@ namespace xAiApi.Data.Helpers
|
||||
//
|
||||
// XTest ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXTestEvents), typeof(XTestEvents), ServiceLifetime.Singleton));
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiProjectEvents), typeof(XAiProjectEvents), ServiceLifetime.Singleton));
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiMessageEvents), typeof(XAiMessageEvents), ServiceLifetime.Singleton));
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiConversationEvents), typeof(XAiConversationEvents), ServiceLifetime.Singleton));
|
||||
#endregion
|
||||
|
||||
//
|
||||
@@ -120,6 +135,18 @@ namespace xAiApi.Data.Helpers
|
||||
//
|
||||
// XTest ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXTestRepository), typeof(XTestEfRepository<XAiApiDbContext>), lifetime));
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiProjectRepository), typeof(XAiProjectEfRepository<XAiApiDbContext>), lifetime));
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiMessageRepository), typeof(XAiMessageEfRepository<XAiApiDbContext>), lifetime));
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiConversationRepository), typeof(XAiConversationEfRepository<XAiApiDbContext>), lifetime));
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -127,6 +154,18 @@ namespace xAiApi.Data.Helpers
|
||||
//
|
||||
// XTest ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXTestRepository), typeof(XTestMongoRepository), lifetime));
|
||||
|
||||
//
|
||||
// XAiProject ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiProjectRepository), typeof(XAiProjectMongoRepository), lifetime));
|
||||
|
||||
//
|
||||
// XAiMessage ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiMessageRepository), typeof(XAiMessageMongoRepository), lifetime));
|
||||
|
||||
//
|
||||
// XAiConversation ...
|
||||
services.Add(new ServiceDescriptor(typeof(IXAiConversationRepository), typeof(XAiConversationMongoRepository), lifetime));
|
||||
break;
|
||||
|
||||
//
|
||||
@@ -145,6 +184,9 @@ namespace xAiApi.Data.Helpers
|
||||
{
|
||||
//
|
||||
services.AddSingleton<IXKeyGenerator<XTest, int>, XIntKeyGenerator<XTest>>();
|
||||
services.AddSingleton<IXKeyGenerator<XAiProject, Guid>, XGuidKeyGenerator<XAiProject>>();
|
||||
services.AddSingleton<IXKeyGenerator<XAiMessage, Guid>, XGuidKeyGenerator<XAiMessage>>();
|
||||
services.AddSingleton<IXKeyGenerator<XAiConversation, Guid>, XGuidKeyGenerator<XAiConversation>>();
|
||||
}
|
||||
|
||||
public void AddDbSeederConfiguration(
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.EFRepositories;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Ef
|
||||
{
|
||||
public class XAiConversationEfRepository<TDbContext> : XBaseEFRepository<XAiConversation, Guid, XAiApiDbContext>, IXAiConversationRepository
|
||||
where TDbContext : XDbContext
|
||||
{
|
||||
//
|
||||
public XAiConversationEfRepository(
|
||||
IXUnitOfWorks<XAiApiDbContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXKeyGenerator<XAiConversation, Guid> keyGenerator = null,
|
||||
IXAiConversationEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IQueryable<XAiConversation> GetFullDbSet()
|
||||
{
|
||||
return dbSet;
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.EFRepositories;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Ef
|
||||
{
|
||||
public class XAiMessageEfRepository<TDbContext> : XBaseEFRepository<XAiMessage, Guid, XAiApiDbContext>, IXAiMessageRepository
|
||||
where TDbContext : XDbContext
|
||||
{
|
||||
//
|
||||
public XAiMessageEfRepository(
|
||||
IXUnitOfWorks<XAiApiDbContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXKeyGenerator<XAiMessage, Guid> keyGenerator = null,
|
||||
IXAiMessageEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IQueryable<XAiMessage> GetFullDbSet()
|
||||
{
|
||||
return dbSet;
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
using xDataService.EFRepositories;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Ef
|
||||
{
|
||||
public class XAiProjectEfRepository<TDbContext> : XBaseEFRepository<XAiProject, Guid, XAiApiDbContext>, IXAiProjectRepository
|
||||
where TDbContext : XDbContext
|
||||
{
|
||||
//
|
||||
public XAiProjectEfRepository(
|
||||
IXUnitOfWorks<XAiApiDbContext> unitOfWorks,
|
||||
XDataServiceConfiguration configuration,
|
||||
IXKeyGenerator<XAiProject, Guid> keyGenerator = null,
|
||||
IXAiProjectEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
unitOfWorks,
|
||||
configuration,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IQueryable<XAiProject> GetFullDbSet()
|
||||
{
|
||||
return dbSet;
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.MongoRepositories;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Mongo
|
||||
{
|
||||
public class XAiConversationMongoRepository : XBaseMongoRepository<XAiConversation, Guid>, IXAiConversationRepository
|
||||
{
|
||||
//
|
||||
public XAiConversationMongoRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXKeyGenerator<XAiConversation, Guid> keyGenerator = null,
|
||||
IXAiConversationEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IMongoQueryable<XAiConversation> GetFullDbSet()
|
||||
{
|
||||
return collection
|
||||
.AsQueryable();
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.MongoRepositories;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Mongo
|
||||
{
|
||||
public class XAiMessageMongoRepository : XBaseMongoRepository<XAiMessage, Guid>, IXAiMessageRepository
|
||||
{
|
||||
//
|
||||
public XAiMessageMongoRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXKeyGenerator<XAiMessage, Guid> keyGenerator = null,
|
||||
IXAiMessageEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IMongoQueryable<XAiMessage> GetFullDbSet()
|
||||
{
|
||||
return collection
|
||||
.AsQueryable();
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MongoDB.Driver;
|
||||
using MongoDB.Driver.Linq;
|
||||
using xAiApi.AI.Interfaces.Entities;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Interfaces;
|
||||
using xDataService.MongoRepositories;
|
||||
|
||||
namespace xAiApi.Data.Repositories.Mongo
|
||||
{
|
||||
public class XAiProjectMongoRepository : XBaseMongoRepository<XAiProject, Guid>, IXAiProjectRepository
|
||||
{
|
||||
//
|
||||
public XAiProjectMongoRepository(
|
||||
XDataServiceConfiguration configuration,
|
||||
string collectionName = null,
|
||||
IXKeyGenerator<XAiProject, Guid> keyGenerator = null,
|
||||
IXAiProjectEvents baseRepositoryEvents = null
|
||||
) : base(
|
||||
configuration,
|
||||
collectionName,
|
||||
keyGenerator,
|
||||
baseRepositoryEvents
|
||||
)
|
||||
{ }
|
||||
|
||||
public override IMongoQueryable<XAiProject> GetFullDbSet()
|
||||
{
|
||||
return collection
|
||||
.AsQueryable();
|
||||
}
|
||||
|
||||
//
|
||||
#region Special ...
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using xAiApi.AI.Models.Entities;
|
||||
using xAiApi.Data.Models.Entities;
|
||||
using xDataService.Configuration;
|
||||
using xDataService.Db;
|
||||
@@ -10,6 +11,13 @@ namespace xAiApi.Data
|
||||
//
|
||||
#region DbSets ...
|
||||
public DbSet<XTest> Tests { get; set; }
|
||||
|
||||
//
|
||||
// Ai Entities ...
|
||||
|
||||
public DbSet<XAiMessage> AiMessages { get; set; }
|
||||
public DbSet<XAiProject> AiProjects { get; set; }
|
||||
public DbSet<XAiConversation> AiConversations { get; set; }
|
||||
#endregion
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user