This commit is contained in:
Zeeshaun
2026-03-13 09:27:34 -05:00
parent 256f579489
commit a675c5f5b0
381 changed files with 20992 additions and 0 deletions
@@ -0,0 +1,37 @@
using MassTransit;
using LCU.Api.Internal.MaidBotLib.Models;
using LCU.API.Internal.RepoApi.Services.RepoOperationServices;
using System;
using LCU.Library.Internal.RepoApiModels.Models.Requests;
namespace LCU.API.Internal.RepoApi.Consumers;
public class RepoAccountProcessingConsumer : IConsumer<RepoAccountProcessingRequest>
{
private readonly IServiceScopeFactory _scopeFactory;
public RepoAccountProcessingConsumer(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task Consume(ConsumeContext<RepoAccountProcessingRequest> context)
{
try
{
using var scope = _scopeFactory.CreateScope();
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IRepoAccountProcessingService>().HandleRequest(context.Message));
}
catch (ServiceException ex)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(ex, "Unexpected Exception In Repo API AccountProcessingRequest Consumer");
throw;
}
catch (Exception exception)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(exception, "Unexpected Exception In Repo API AccountProcessingRequest Consumer");
throw;
}
}
}
@@ -0,0 +1,47 @@
using MassTransit;
using LCU.Library.Internal.RepoApiModels.Models;
using LCU.Api.Internal.MaidBotLib.Models;
using LCU.API.Internal.RepoApi.Services.RepoOperationServices;
using System;
namespace LCU.API.Internal.RepoApi.Consumers;
public class RepoBatchCompletionProcessingConsumer : IConsumer<Batch<RepoSyncBatch>>
{
private readonly IServiceScopeFactory _scopeFactory;
public RepoBatchCompletionProcessingConsumer(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task Consume(ConsumeContext<Batch<RepoSyncBatch>> context)
{
try
{
using var scope = _scopeFactory.CreateScope();
var repoBatchCompletionItems = new List<RepoSyncBatch>();
for (int index = 0; index < context.Message.Length; index++)
{
ConsumeContext<RepoSyncBatch> messageContext = context.Message[index];
repoBatchCompletionItems.Add(messageContext.Message);
}
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IRepoBatchCompletionService>().HandleRequest(repoBatchCompletionItems));
}
catch (ServiceException ex)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(ex, "Unexpected Exception In Repo API Batch Completion Consumer");
throw;
}
catch (Exception exception)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(exception, "Unexpected Exception In Repo API Batch Completion Consumer");
throw;
}
}
}
@@ -0,0 +1,37 @@
using MassTransit;
using LCU.Api.Internal.MaidBotLib.Models;
using LCU.API.Internal.RepoApi.Services.RepoOperationServices;
using System;
using LCU.Library.Internal.RepoApiModels.Models.Requests;
namespace LCU.API.Internal.RepoApi.Consumers;
public class RepoBatchProcessingConsumer : IConsumer<RepoBatchRequest>
{
private readonly IServiceScopeFactory _scopeFactory;
public RepoBatchProcessingConsumer(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task Consume(ConsumeContext<RepoBatchRequest> context)
{
try
{
using var scope = _scopeFactory.CreateScope();
await Task.Run(() => scope.ServiceProvider.GetRequiredService<IRepoBatchProcessingService>().HandleRequest(context.Message));
}
catch (ServiceException ex)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(ex, "Unexpected Exception In Repo API Batch Processing Consumer");
throw;
}
catch (Exception exception)
{
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group), Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
.Error(exception, "Unexpected Exception In Repo API Batch Processing Consumer");
throw;
}
}
}