Updates
This commit is contained in:
@@ -5,7 +5,6 @@ FROM mcr.microsoft.com/dotnet/sdk:8.0 AS aspnetcore-build
|
|||||||
COPY LCU.API.Internal.MemberPreferencesApi/LCU.API.Internal.MemberPreferencesApi.csproj ./source/LCU.API.Internal.MemberPreferencesApi/
|
COPY LCU.API.Internal.MemberPreferencesApi/LCU.API.Internal.MemberPreferencesApi.csproj ./source/LCU.API.Internal.MemberPreferencesApi/
|
||||||
COPY LCU.API.Internal.MemberPreferencesApiLib/LCU.API.Internal.MemberPreferencesApiLib.csproj ./source/LCU.API.Internal.MemberPreferencesApiLib/
|
COPY LCU.API.Internal.MemberPreferencesApiLib/LCU.API.Internal.MemberPreferencesApiLib.csproj ./source/LCU.API.Internal.MemberPreferencesApiLib/
|
||||||
COPY LCU.Library.Internal.MemberPreferencesApiModels/LCU.Library.Internal.MemberPreferencesApiModels.csproj ./source/LCU.Library.Internal.MemberPreferencesApiModels/
|
COPY LCU.Library.Internal.MemberPreferencesApiModels/LCU.Library.Internal.MemberPreferencesApiModels.csproj ./source/LCU.Library.Internal.MemberPreferencesApiModels/
|
||||||
COPY LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/
|
|
||||||
|
|
||||||
# Install Credential Provider and set env variables to enable Nuget restore with auth
|
# Install Credential Provider and set env variables to enable Nuget restore with auth
|
||||||
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
||||||
@@ -20,7 +19,10 @@ RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-I
|
|||||||
COPY . ./source/
|
COPY . ./source/
|
||||||
|
|
||||||
LABEL test=true
|
LABEL test=true
|
||||||
|
COPY LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/
|
||||||
|
|
||||||
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
||||||
|
|
||||||
RUN dotnet test -c Release --results-directory /testresults --logger "trx;LogFileName=test_results.trx" ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
RUN dotnet test -c Release --results-directory /testresults --logger "trx;LogFileName=test_results.trx" ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
||||||
|
|
||||||
# .NET Core Publish
|
# .NET Core Publish
|
||||||
|
|||||||
+1
-4
@@ -18,8 +18,6 @@ namespace LCU.API.Internal.MemberPreferencesApi.IntegrationTests
|
|||||||
private Mock<IUnifiedOptInRepository> _mockUnifiedOptinRepository;
|
private Mock<IUnifiedOptInRepository> _mockUnifiedOptinRepository;
|
||||||
private Mock<IMemberPreferenceRepository> _mockMemberPreferenceRepository;
|
private Mock<IMemberPreferenceRepository> _mockMemberPreferenceRepository;
|
||||||
private Mock<IFileOperationsApiService> _mockFileOperationsApiService;
|
private Mock<IFileOperationsApiService> _mockFileOperationsApiService;
|
||||||
private IMock<IXdiBatchProcessInfoRepository> _mockXdiBatchProcessInfoRepository;
|
|
||||||
|
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@@ -27,7 +25,6 @@ namespace LCU.API.Internal.MemberPreferencesApi.IntegrationTests
|
|||||||
_mockFileOperationsApiService = new Mock<IFileOperationsApiService>();
|
_mockFileOperationsApiService = new Mock<IFileOperationsApiService>();
|
||||||
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
||||||
_mockBatchItemsRepository = new Mock<IXdiBatchItemsRepository>();
|
_mockBatchItemsRepository = new Mock<IXdiBatchItemsRepository>();
|
||||||
_mockXdiBatchProcessInfoRepository = new Mock<IXdiBatchProcessInfoRepository>();
|
|
||||||
_mockUnitOfWork = new Mock<IUnitOfWork>();
|
_mockUnitOfWork = new Mock<IUnitOfWork>();
|
||||||
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
||||||
_mockMemberPreferenceRepository = new Mock<IMemberPreferenceRepository>();
|
_mockMemberPreferenceRepository = new Mock<IMemberPreferenceRepository>();
|
||||||
@@ -35,7 +32,7 @@ namespace LCU.API.Internal.MemberPreferencesApi.IntegrationTests
|
|||||||
|
|
||||||
_xdiBatchItemService = new XdiBatchService(_mockBatchItemsRepository.Object, _mockUnitOfWork.Object,
|
_xdiBatchItemService = new XdiBatchService(_mockBatchItemsRepository.Object, _mockUnitOfWork.Object,
|
||||||
_mockUnifiedOptinRepository.Object, _mockMemberPreferenceRepository.Object,
|
_mockUnifiedOptinRepository.Object, _mockMemberPreferenceRepository.Object,
|
||||||
_mockFileOperationsApiService.Object, _mockXdiBatchProcessInfoRepository.Object);
|
_mockFileOperationsApiService.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
-1
@@ -10,7 +10,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentAssertions" Version="6.8.0" />
|
<PackageReference Include="FluentAssertions" Version="6.8.0" />
|
||||||
<PackageReference Include="LCU.Library.Internal.CoreApiWrapperModel" Version="2.27.14" />
|
<PackageReference Include="LCU.Library.Internal.CoreApiWrapperModel" Version="2.27.14" />
|
||||||
<PackageReference Include="LCU.Library.Internal.LcuClassPatterns.CrudTests" Version="1.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.5" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
|
||||||
<PackageReference Include="Moq" Version="4.18.4" />
|
<PackageReference Include="Moq" Version="4.18.4" />
|
||||||
|
|||||||
+32
-30
@@ -3,8 +3,8 @@ using LCU.API.Internal.MemberPreferencesApi.Models;
|
|||||||
using LCU.API.Internal.MemberPreferencesApi.Models.Requests;
|
using LCU.API.Internal.MemberPreferencesApi.Models.Requests;
|
||||||
using LCU.API.Internal.MemberPreferencesApi.Services.XdiServices;
|
using LCU.API.Internal.MemberPreferencesApi.Services.XdiServices;
|
||||||
using LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
using LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
||||||
using LCU.Library.Internal.LcuClassPatterns.CrudTests.Tests;
|
using LCU.Library.Internal.ApiResponse.Models;
|
||||||
using LCU.Library.Internal.LcuClassPatterns.CrudTests.Utilities;
|
using LCU.Library.Internal.FileOperationsModels.Models;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||||
using Moq;
|
using Moq;
|
||||||
@@ -17,11 +17,10 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
||||||
{
|
{
|
||||||
public class XdiBatchItemServiceTest : CrudServiceTest<XdiBatchProcessInfo>
|
public class XdiBatchItemServiceTest
|
||||||
{
|
{
|
||||||
private IXdiBatchService _xdiBatchItemService;
|
private IXdiBatchService _xdiBatchItemService;
|
||||||
private Mock<IXdiBatchItemsRepository> _mockBatchItemsRepository;
|
private Mock<IXdiBatchItemsRepository> _mockBatchItemsRepository;
|
||||||
private Mock<IXdiBatchProcessInfoRepository> _mockXdiBatchProcessInfoRepository;
|
|
||||||
private Mock<IUnitOfWork> _mockUnitOfWork;
|
private Mock<IUnitOfWork> _mockUnitOfWork;
|
||||||
private Mock<IUnifiedOptInRepository> _mockUnifiedOptinRepository;
|
private Mock<IUnifiedOptInRepository> _mockUnifiedOptinRepository;
|
||||||
private Mock<IMemberPreferenceRepository> _mockMemberPreferenceRepository;
|
private Mock<IMemberPreferenceRepository> _mockMemberPreferenceRepository;
|
||||||
@@ -31,7 +30,6 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_mockBatchItemsRepository = new Mock<IXdiBatchItemsRepository>();
|
_mockBatchItemsRepository = new Mock<IXdiBatchItemsRepository>();
|
||||||
_mockXdiBatchProcessInfoRepository = new Mock<IXdiBatchProcessInfoRepository>();
|
|
||||||
_mockUnitOfWork = new Mock<IUnitOfWork>();
|
_mockUnitOfWork = new Mock<IUnitOfWork>();
|
||||||
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
_mockUnifiedOptinRepository = new Mock<IUnifiedOptInRepository>();
|
||||||
_mockMemberPreferenceRepository = new Mock<IMemberPreferenceRepository>();
|
_mockMemberPreferenceRepository = new Mock<IMemberPreferenceRepository>();
|
||||||
@@ -39,7 +37,7 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
|
|
||||||
_xdiBatchItemService = new XdiBatchService(_mockBatchItemsRepository.Object, _mockUnitOfWork.Object,
|
_xdiBatchItemService = new XdiBatchService(_mockBatchItemsRepository.Object, _mockUnitOfWork.Object,
|
||||||
_mockUnifiedOptinRepository.Object, _mockMemberPreferenceRepository.Object,
|
_mockUnifiedOptinRepository.Object, _mockMemberPreferenceRepository.Object,
|
||||||
_mockFileOperationsApiService.Object, _mockXdiBatchProcessInfoRepository.Object);
|
_mockFileOperationsApiService.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -305,14 +303,17 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
UniversalOptIn = DeliveryPreference.Hold
|
UniversalOptIn = DeliveryPreference.Hold
|
||||||
});
|
});
|
||||||
|
|
||||||
var xdiBatchProcessInfo = new List<XdiBatchProcessInfo>
|
var appendFileResponse = new RequestResponse
|
||||||
{
|
{
|
||||||
new()
|
IsSuccessful = true,
|
||||||
|
ReturnResponse = new ReturnResponse
|
||||||
{
|
{
|
||||||
XdiBatchProcessInfoId = (int)typeof(int).GetRandomValue(),
|
ResponseItems = new List<ResponseItem>() {
|
||||||
StartTimeStamp = DateTime.Now,
|
new()
|
||||||
XdiBatchProcessStatus = XdiBatchProcessStatus.InProgress,
|
{
|
||||||
ApiResponse = "Started"
|
ResponsePayload = "File Created"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -321,10 +322,9 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
XdiAppendFileRootBasePath = "test/test"
|
XdiAppendFileRootBasePath = "test/test"
|
||||||
};
|
};
|
||||||
|
|
||||||
_mockXdiBatchProcessInfoRepository.Setup(x => x.FindBatchProcessInfoByStatus(XdiBatchProcessStatus.InProgress)).ReturnsAsync(xdiBatchProcessInfo)
|
_mockFileOperationsApiService.Setup(x => x.AppendFile(It.IsAny<AppendFileRequest>())).ReturnsAsync(appendFileResponse).Verifiable();
|
||||||
.Verifiable();
|
|
||||||
|
|
||||||
var results = await _xdiBatchItemService.BuildXdiFiles(testFile, request.XdiAppendFileRootBasePath, xdiBatchProcessInfo.FirstOrDefault());
|
var results = await _xdiBatchItemService.BuildXdiFiles(testFile, request.XdiAppendFileRootBasePath);
|
||||||
|
|
||||||
Assert.AreEqual(4, results.Count);
|
Assert.AreEqual(4, results.Count);
|
||||||
Assert.True(results.Exists(x => x.UserId == "100" && x.Value == "[email protected]"));
|
Assert.True(results.Exists(x => x.UserId == "100" && x.Value == "[email protected]"));
|
||||||
@@ -347,17 +347,6 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var xdiBatchProcessInfo = new List<XdiBatchProcessInfo>
|
|
||||||
{
|
|
||||||
new()
|
|
||||||
{
|
|
||||||
XdiBatchProcessInfoId = (int)typeof(int).GetRandomValue(),
|
|
||||||
StartTimeStamp = DateTime.Now,
|
|
||||||
XdiBatchProcessStatus = XdiBatchProcessStatus.InProgress,
|
|
||||||
ApiResponse = "Started"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
_mockUnifiedOptinRepository
|
_mockUnifiedOptinRepository
|
||||||
.Setup(x => x.GetMemberOptInSettingsNoTracking("100")).ReturnsAsync(new MemberOptInSettings
|
.Setup(x => x.GetMemberOptInSettingsNoTracking("100")).ReturnsAsync(new MemberOptInSettings
|
||||||
{
|
{
|
||||||
@@ -369,15 +358,28 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests.Services
|
|||||||
.Setup(x => x.GetMemberOptInSettingsNoTracking(It.Is<string>(userId => int.Parse(userId) > 100)))
|
.Setup(x => x.GetMemberOptInSettingsNoTracking(It.Is<string>(userId => int.Parse(userId) > 100)))
|
||||||
.Returns(Task.FromResult<MemberOptInSettings>(null));
|
.Returns(Task.FromResult<MemberOptInSettings>(null));
|
||||||
|
|
||||||
_mockXdiBatchProcessInfoRepository.Setup(x => x.FindBatchProcessInfoByStatus(XdiBatchProcessStatus.InProgress)).ReturnsAsync(xdiBatchProcessInfo)
|
|
||||||
.Verifiable();
|
|
||||||
|
|
||||||
var request = new XdiBatchRequest()
|
var request = new XdiBatchRequest()
|
||||||
{
|
{
|
||||||
XdiAppendFileRootBasePath = "test/test"
|
XdiAppendFileRootBasePath = "test/test"
|
||||||
};
|
};
|
||||||
|
|
||||||
var results = await _xdiBatchItemService.BuildXdiFiles(testFile, request.XdiAppendFileRootBasePath, xdiBatchProcessInfo.FirstOrDefault());
|
var appendFileResponse = new RequestResponse
|
||||||
|
{
|
||||||
|
IsSuccessful = true,
|
||||||
|
ReturnResponse = new ReturnResponse
|
||||||
|
{
|
||||||
|
ResponseItems = new List<ResponseItem>() {
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
ResponsePayload = "File Created"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockFileOperationsApiService.Setup(x => x.AppendFile(It.IsAny<AppendFileRequest>())).ReturnsAsync(appendFileResponse).Verifiable();
|
||||||
|
|
||||||
|
var results = await _xdiBatchItemService.BuildXdiFiles(testFile, request.XdiAppendFileRootBasePath);
|
||||||
|
|
||||||
Assert.AreEqual(1, results.Count);
|
Assert.AreEqual(1, results.Count);
|
||||||
Assert.True(results.Exists(x => x.UserId == "100" && x.Value == DeliveryPreference.Paper));
|
Assert.True(results.Exists(x => x.UserId == "100" && x.Value == DeliveryPreference.Paper));
|
||||||
|
|||||||
-53
@@ -2,7 +2,6 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||||
using LCU.API.Internal.MemberPreferencesApi.Models;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApi.UnitTests
|
namespace LCU.API.Internal.MemberPreferencesApi.UnitTests
|
||||||
@@ -162,57 +161,5 @@ namespace LCU.API.Internal.MemberPreferencesApi.UnitTests
|
|||||||
Assert.AreEqual(1, files.Count);
|
Assert.AreEqual(1, files.Count);
|
||||||
Assert.AreEqual(XdiFileType.UpdateMemberEmail, files.First().Type);
|
Assert.AreEqual(XdiFileType.UpdateMemberEmail, files.First().Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_Enrollment_Microfiche()
|
|
||||||
{
|
|
||||||
var batch = new Models.XdiBatch();
|
|
||||||
var settings = new MemberOptInSettings()
|
|
||||||
{
|
|
||||||
Id = 1000,
|
|
||||||
UniversalOptIn = DeliveryPreference.Microfiche,
|
|
||||||
ENotifications = DeliveryPreference.Electronic,
|
|
||||||
EStatements = DeliveryPreference.Electronic,
|
|
||||||
UnifiedOptInEmail = "[email protected]",
|
|
||||||
ENotificationsEmail = "[email protected]",
|
|
||||||
EStatementsEmail = "[email protected]",
|
|
||||||
UserId = "99"
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = batch.ProcessItem(_item, settings);
|
|
||||||
|
|
||||||
Assert.True(result);
|
|
||||||
var files = batch.GetNonEmptyFiles();
|
|
||||||
Assert.NotNull(files);
|
|
||||||
Assert.AreEqual(1, files.Count);
|
|
||||||
Assert.AreEqual(XdiFileType.UpdateMemberToPrint, files.First().Type);
|
|
||||||
Assert.AreEqual("[email protected]", files.First().Data.First().Email);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Test_Enrollment_Hold()
|
|
||||||
{
|
|
||||||
var batch = new Models.XdiBatch();
|
|
||||||
var settings = new MemberOptInSettings()
|
|
||||||
{
|
|
||||||
Id = 1000,
|
|
||||||
UniversalOptIn = DeliveryPreference.Hold,
|
|
||||||
ENotifications = DeliveryPreference.Electronic,
|
|
||||||
EStatements = DeliveryPreference.Electronic,
|
|
||||||
UnifiedOptInEmail = "[email protected]",
|
|
||||||
ENotificationsEmail = "[email protected]",
|
|
||||||
EStatementsEmail = "[email protected]",
|
|
||||||
UserId = "99"
|
|
||||||
};
|
|
||||||
|
|
||||||
var result = batch.ProcessItem(_item, settings);
|
|
||||||
|
|
||||||
Assert.True(result);
|
|
||||||
var files = batch.GetNonEmptyFiles();
|
|
||||||
Assert.NotNull(files);
|
|
||||||
Assert.AreEqual(1, files.Count);
|
|
||||||
Assert.AreEqual(XdiFileType.UpdateMemberToPrint, files.First().Type);
|
|
||||||
Assert.AreEqual("[email protected]", files.First().Data.First().Email);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-8
@@ -21,14 +21,6 @@ public class DnaAuditProcessConsumer : IConsumer<DnaAuditProcessRequest>
|
|||||||
await scope.ServiceProvider.GetRequiredService<IDNADataAuditProcessService>().HandleDnaAuditProcessRequest(context.Message);
|
await scope.ServiceProvider.GetRequiredService<IDNADataAuditProcessService>().HandleDnaAuditProcessRequest(context.Message);
|
||||||
Log.Debug("Ending DnaAuditProcessConsumer.");
|
Log.Debug("Ending DnaAuditProcessConsumer.");
|
||||||
}
|
}
|
||||||
catch (ServiceException serviceException)
|
|
||||||
{
|
|
||||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
|
||||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
|
||||||
.Error(serviceException, $"DnaAuditProcess Failure. " +
|
|
||||||
$"The request is placed on DnaAuditProcess_error.");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||||
|
|||||||
-9
@@ -17,15 +17,6 @@ public class XdiBatchProcessConsumer : IConsumer<XdiBatchProcessRequest>
|
|||||||
using var scope = _scopeFactory.CreateScope();
|
using var scope = _scopeFactory.CreateScope();
|
||||||
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IXdiBatchProcessService>().HandleXdiBatchProcess(context.Message));
|
await Task.Run(async () => await scope.ServiceProvider.GetRequiredService<IXdiBatchProcessService>().HandleXdiBatchProcess(context.Message));
|
||||||
}
|
}
|
||||||
catch (ServiceException ex)
|
|
||||||
{
|
|
||||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
|
||||||
Enum.GetName(typeof(GroupEnum), GroupEnum.ITDevelopment))
|
|
||||||
.Error($"XdiBatchProcessConsumer Failure. " +
|
|
||||||
$"The response is placed on LCU.MemberPreferencesApi.XdiBatchProcess_error. " +
|
|
||||||
$"Error Message: {ex.Message}");
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
Log.ForContext(Enum.GetName(typeof(PropertyEnum), PropertyEnum.Group),
|
||||||
|
|||||||
+2
@@ -1,8 +1,10 @@
|
|||||||
using LCU.API.Internal.MemberPreferencesApi.Services.QueueServices;
|
using LCU.API.Internal.MemberPreferencesApi.Services.QueueServices;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.FeatureManagement.Mvc;
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApi.Controllers;
|
namespace LCU.API.Internal.MemberPreferencesApi.Controllers;
|
||||||
|
|
||||||
|
[FeatureGate(FeatureGates.EnableControllers)]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
public class QueueXdiBatchProcessController : ControllerBase
|
public class QueueXdiBatchProcessController : ControllerBase
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@
|
|||||||
<PackageReference Include="LCU.Api.Internal.MaidBotLib" Version="1.0.2" />
|
<PackageReference Include="LCU.Api.Internal.MaidBotLib" Version="1.0.2" />
|
||||||
<PackageReference Include="LCU.Library.Internal.Exceptions" Version="2.0.0" />
|
<PackageReference Include="LCU.Library.Internal.Exceptions" Version="2.0.0" />
|
||||||
<PackageReference Include="LCU.Library.Internal.FileOperationsModels" Version="4.1.5" />
|
<PackageReference Include="LCU.Library.Internal.FileOperationsModels" Version="4.1.5" />
|
||||||
<PackageReference Include="LCU.Library.Internal.LcuClassPatterns.Crud" Version="1.0.2" />
|
|
||||||
<PackageReference Include="LCU.Library.Internal.LcuHttpClient" Version="1.21.0" />
|
<PackageReference Include="LCU.Library.Internal.LcuHttpClient" Version="1.21.0" />
|
||||||
<PackageReference Include="LCU.Library.Internal.LcuMassTransit" Version="1.0.0" />
|
<PackageReference Include="LCU.Library.Internal.LcuMassTransit" Version="1.0.0" />
|
||||||
<PackageReference Include="LCU.Library.Internal.LcuMassTransitModels" Version="1.1.0" />
|
<PackageReference Include="LCU.Library.Internal.LcuMassTransitModels" Version="1.1.0" />
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ public class XdiBatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentSettings.UniversalOptIn == DeliveryPreference.Microfiche &&
|
if (currentSettings.UniversalOptIn == DeliveryPreference.Microfiche &&
|
||||||
currentSettings.ENotifications == DeliveryPreference.Electronic)
|
currentSettings.ENotifications == DeliveryPreference.Electronic)
|
||||||
{
|
{
|
||||||
_updateMemberToPrint.AddRow(item.UserId, currentSettings.UnifiedOptInEmail);
|
_updateMemberToPrint.AddRow(item.UserId, currentSettings.UnifiedOptInEmail);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ void AddMemberPreferencesLib(ref IServiceCollection services)
|
|||||||
services.AddScoped<IMemberPreferenceRepository, MemberPreferenceRepository>();
|
services.AddScoped<IMemberPreferenceRepository, MemberPreferenceRepository>();
|
||||||
services.AddScoped<IMemberPreferences, MemberPreferenceRepository>();
|
services.AddScoped<IMemberPreferences, MemberPreferenceRepository>();
|
||||||
services.AddScoped<IXdiBatchItemsRepository, XdiBatchItemsRepository>();
|
services.AddScoped<IXdiBatchItemsRepository, XdiBatchItemsRepository>();
|
||||||
services.AddScoped<IXdiBatchProcessInfoRepository, XdiBatchProcessInfoRepository>();
|
|
||||||
services.AddScoped<IDnaAuditProcessRepository, DnaAuditProcessRepository>();
|
services.AddScoped<IDnaAuditProcessRepository, DnaAuditProcessRepository>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -50,7 +50,6 @@ public class DNADataAuditProcessService : IDNADataAuditProcessService
|
|||||||
Log.Error(ex.Message);
|
Log.Error(ex.Message);
|
||||||
// Return successful as True so Dispatcher job never stops running.
|
// Return successful as True so Dispatcher job never stops running.
|
||||||
await QueueReturnResponse.QueueResponse(request, true, new List<string>() { ex.Message });
|
await QueueReturnResponse.QueueResponse(request, true, new List<string>() { ex.Message });
|
||||||
throw new ServiceException($"Failed to handled Consumed DnaAuditProcessRequest. ExceptionMessage: {ex.Message}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ namespace LCU.API.Internal.MemberPreferencesApi.MicroApiServices
|
|||||||
{
|
{
|
||||||
var result = await _fileOperationsApiDao.AppendFileAsync(request);
|
var result = await _fileOperationsApiDao.AppendFileAsync(request);
|
||||||
|
|
||||||
Log.Information($"XDI File Sent, Response: {result.ReturnResponse}");
|
Log.Information($"XDI File Saved. Response: {result.ReturnResponse}");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,6 @@
|
|||||||
using LCU.API.Internal.MemberPreferencesApi.Models;
|
using LCU.API.Internal.MemberPreferencesApi.Models;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
||||||
|
using LCU.Library.Internal.MemberPreferencesApiModels.Responses;
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices;
|
namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices;
|
||||||
|
|
||||||
@@ -7,9 +8,9 @@ public interface IXdiBatchService
|
|||||||
{
|
{
|
||||||
Task AddXdiBatchItem(XdiBatchItem newItem);
|
Task AddXdiBatchItem(XdiBatchItem newItem);
|
||||||
Task SaveRangeAsync(List<XdiBatchItem> xdiBatchItemList);
|
Task SaveRangeAsync(List<XdiBatchItem> xdiBatchItemList);
|
||||||
Task CreateXdiBatchFiles(XdiBatchRequest request);
|
Task<RequestResponse> CreateXdiBatchFiles(XdiBatchRequest request);
|
||||||
Task<XdiBatchRequest> BuildXdiBatchRequest(XdiBatchRequest request);
|
Task<XdiBatchRequest> BuildXdiBatchRequest(XdiBatchRequest request);
|
||||||
Task<List<XdiBatchFileExport>> BuildXdiFiles(XdiBatchFile batchFile, string filePath, XdiBatchProcessInfo xdiBatchProcessInfo);
|
Task<List<XdiBatchFileExport>> BuildXdiFiles(XdiBatchFile batchFile, string filePath);
|
||||||
Task<bool> MarkPendingSuccessful(List<XdiBatchFileExport> batchFileExportList);
|
Task<bool> MarkPendingSuccessful(List<XdiBatchFileExport> batchFileExportList);
|
||||||
Task<bool> DoesMemberHavePendingXdiChange(string memberId);
|
Task<bool> DoesMemberHavePendingXdiChange(string memberId);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -36,8 +36,8 @@ public class XdiBatchProcessService : IXdiBatchProcessService
|
|||||||
XdiAppendFileRootBasePath = xdiBatchProcessRequest.XdiAppendFileRootBasePath
|
XdiAppendFileRootBasePath = xdiBatchProcessRequest.XdiAppendFileRootBasePath
|
||||||
};
|
};
|
||||||
|
|
||||||
await _xdiBatchService.CreateXdiBatchFiles(request);
|
var result = await _xdiBatchService.CreateXdiBatchFiles(request);
|
||||||
await QueueReturnResponse.QueueResponse(xdiBatchProcessRequest, true, new List<string> { $"Requested {xdiBatchItems.Count()} Xdi Batch Items to Process."});
|
await QueueReturnResponse.QueueResponse(xdiBatchProcessRequest, result.IsSuccessful, result.MessageStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -45,7 +45,6 @@ public class XdiBatchProcessService : IXdiBatchProcessService
|
|||||||
var errorMessage = $"Failed to HandleXdiBatchProcess. Exception Message: {ex.Message}";
|
var errorMessage = $"Failed to HandleXdiBatchProcess. Exception Message: {ex.Message}";
|
||||||
Log.Error(errorMessage);
|
Log.Error(errorMessage);
|
||||||
await QueueReturnResponse.QueueResponse(xdiBatchProcessRequest, false, new List<string>() {errorMessage});
|
await QueueReturnResponse.QueueResponse(xdiBatchProcessRequest, false, new List<string>() {errorMessage});
|
||||||
throw new ServiceException(errorMessage);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-75
@@ -1,17 +1,15 @@
|
|||||||
using LCU.API.Internal.MemberPreferencesApi.MicroApiServices;
|
using LCU.API.Internal.MemberPreferencesApi.MicroApiServices;
|
||||||
using LCU.API.Internal.MemberPreferencesApi.Models;
|
using LCU.API.Internal.MemberPreferencesApi.Models;
|
||||||
using LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
using LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
||||||
using LCU.Library.Internal.FileOperationsModels.Models;
|
|
||||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Services;
|
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
||||||
using System.Data.SqlClient;
|
using LCU.Library.Internal.MemberPreferencesApiModels.Responses;
|
||||||
|
using FileOperationsModels = LCU.Library.Internal.FileOperationsModels.Models;
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices
|
namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices
|
||||||
{
|
{
|
||||||
public class XdiBatchService : CrudService<XdiBatchProcessInfo>, IXdiBatchService
|
public class XdiBatchService : IXdiBatchService
|
||||||
{
|
{
|
||||||
private readonly IXdiBatchProcessInfoRepository _xdiBatchProcessInfoRepository;
|
|
||||||
private readonly IXdiBatchItemsRepository _xdiBatchItemsRepository;
|
private readonly IXdiBatchItemsRepository _xdiBatchItemsRepository;
|
||||||
private readonly IUnifiedOptInRepository _unifiedOptInRepository;
|
private readonly IUnifiedOptInRepository _unifiedOptInRepository;
|
||||||
private readonly IMemberPreferenceRepository _memberPreferenceRepository;
|
private readonly IMemberPreferenceRepository _memberPreferenceRepository;
|
||||||
@@ -21,39 +19,32 @@ namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices
|
|||||||
|
|
||||||
public XdiBatchService(IXdiBatchItemsRepository xdiBatchItemsRepository,
|
public XdiBatchService(IXdiBatchItemsRepository xdiBatchItemsRepository,
|
||||||
IUnitOfWork unitOfWork, IUnifiedOptInRepository unifiedOptInRepository,
|
IUnitOfWork unitOfWork, IUnifiedOptInRepository unifiedOptInRepository,
|
||||||
IMemberPreferenceRepository memberPreferencesRepository, IFileOperationsApiService fileOperationsApiService,
|
IMemberPreferenceRepository memberPreferencesRepository, IFileOperationsApiService fileOperationsApiService)
|
||||||
IXdiBatchProcessInfoRepository xdiBatchProcessInfoRepository) : base(xdiBatchProcessInfoRepository)
|
|
||||||
{
|
{
|
||||||
_xdiBatchItemsRepository = xdiBatchItemsRepository;
|
_xdiBatchItemsRepository = xdiBatchItemsRepository;
|
||||||
_unitOfWork = unitOfWork;
|
_unitOfWork = unitOfWork;
|
||||||
_memberPreferenceRepository = memberPreferencesRepository;
|
_memberPreferenceRepository = memberPreferencesRepository;
|
||||||
_unifiedOptInRepository = unifiedOptInRepository;
|
_unifiedOptInRepository = unifiedOptInRepository;
|
||||||
_fileOperationsApiService = fileOperationsApiService;
|
_fileOperationsApiService = fileOperationsApiService;
|
||||||
_xdiBatchProcessInfoRepository = xdiBatchProcessInfoRepository;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CreateXdiBatchFiles(XdiBatchRequest request)
|
public async Task<RequestResponse> CreateXdiBatchFiles(XdiBatchRequest request)
|
||||||
{
|
{
|
||||||
var batchProcessInfo = new XdiBatchProcessInfo();
|
var requestResponse = new RequestResponse();
|
||||||
var batchUserIds = string.Join(",", request.XdiBatchItems.Select(c => c.UserId).ToList());
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var batchProcessInProgress = _xdiBatchProcessInfoRepository.FindBatchProcessInfoByStatus(XdiBatchProcessStatus.InProgress).Result;
|
request = await BuildXdiBatchRequest(request);
|
||||||
if (batchProcessInProgress.Count() == 0)
|
requestResponse = await CreateXdiExportFileRequest(request);
|
||||||
{
|
|
||||||
request = await BuildXdiBatchRequest(request);
|
|
||||||
batchProcessInfo = await CreateNewBatchProcessInfo(request.XdiBatchItems.Count());
|
|
||||||
await CreateXdiExportFileRequest(request, batchProcessInfo);
|
|
||||||
|
|
||||||
await UpdateBatchAsync(batchProcessInfo, XdiBatchProcessStatus.Completed, $"Completed XDI Batch Process for UserIds: {batchUserIds}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, $"Failed to Create XDI Batch Files.");
|
var batchUserIds = string.Join(",", request.XdiBatchItems.Select(c => c.UserId).ToList());
|
||||||
await UpdateBatchAsync(batchProcessInfo, XdiBatchProcessStatus.Failed, $"Failed XDI Batch Process for UserIds: {batchUserIds}");
|
var errorMessage = $"Failed to Create XDI Batch Files for UserId(s): {batchUserIds} Error: { ex.Message}";
|
||||||
throw new ServiceException($"Failed to Create XDI Batch Files. Exception Message: {ex.Message}");
|
Log.Error(errorMessage);
|
||||||
|
requestResponse.MessageStack.Add(errorMessage);
|
||||||
|
requestResponse.IsSuccessful = false;
|
||||||
}
|
}
|
||||||
|
return requestResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<XdiBatchRequest> BuildXdiBatchRequest(XdiBatchRequest request)
|
public async Task<XdiBatchRequest> BuildXdiBatchRequest(XdiBatchRequest request)
|
||||||
@@ -81,45 +72,62 @@ namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices
|
|||||||
Log.Error($"No XdiBatchRow or XDI File was processed based on current member UserId: {item.UserId} Opt In Settings, marking complete.");
|
Log.Error($"No XdiBatchRow or XDI File was processed based on current member UserId: {item.UserId} Opt In Settings, marking complete.");
|
||||||
_xdiBatchItemsRepository.Delete(item);
|
_xdiBatchItemsRepository.Delete(item);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
};
|
;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
await _unitOfWork.CompleteAsync(XdiBatchProcessOperatorName, DateTime.UtcNow, UserType.System);
|
await _unitOfWork.CompleteAsync(XdiBatchProcessOperatorName, DateTime.UtcNow, UserType.System);
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CreateXdiExportFileRequest(XdiBatchRequest request, XdiBatchProcessInfo xdiBatchProcessInfo)
|
public async Task<RequestResponse> CreateXdiExportFileRequest(XdiBatchRequest request)
|
||||||
{
|
{
|
||||||
|
var requestResponse = new RequestResponse();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IReadOnlyCollection<XdiBatchFile> batchFiles = request.XdiBatch.GetNonEmptyFiles();
|
IReadOnlyCollection<XdiBatchFile> batchFiles = request.XdiBatch.GetNonEmptyFiles();
|
||||||
Log.Information($"XdiBatchService produced {batchFiles.Count} files");
|
var batchFilesMessage = ($"XdiBatchService produced {batchFiles.Count} file(s)");
|
||||||
|
Log.Information(batchFilesMessage);
|
||||||
|
|
||||||
foreach (var xdiBatchFile in batchFiles)
|
foreach (var xdiBatchFile in batchFiles)
|
||||||
{
|
{
|
||||||
var xdiBatchFileExport = await BuildXdiFiles(xdiBatchFile, request.XdiAppendFileRootBasePath, xdiBatchProcessInfo);
|
var xdiBatchFileExport = await BuildXdiFiles(xdiBatchFile, request.XdiAppendFileRootBasePath);
|
||||||
await MarkPendingSuccessful(xdiBatchFileExport);
|
if (xdiBatchFileExport != null)
|
||||||
|
{
|
||||||
|
await MarkPendingSuccessful(xdiBatchFileExport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
requestResponse.IsSuccessful = true;
|
||||||
|
requestResponse.MessageStack.Add(batchFilesMessage);
|
||||||
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, $"Failed to Create the XDI File to export.");
|
var errorMessage = $"Failed to Create the XDI File to export. {ex.Message}";
|
||||||
|
Log.Error(errorMessage);
|
||||||
|
requestResponse.MessageStack.Add(errorMessage);
|
||||||
|
requestResponse.IsSuccessful = false;
|
||||||
}
|
}
|
||||||
|
return requestResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<XdiBatchFileExport>> BuildXdiFiles(XdiBatchFile batchFile, string filePath, XdiBatchProcessInfo xdiBatchProcessInfo)
|
public async Task<List<XdiBatchFileExport>> BuildXdiFiles(XdiBatchFile batchFile, string filePath)
|
||||||
{
|
{
|
||||||
AppendFileRequest request = BuildFileOperationsRequest(batchFile, filePath);
|
FileOperationsModels.AppendFileRequest request = BuildFileOperationsRequest(batchFile, filePath);
|
||||||
var xdiBatchFileExport = await CreateDirectoryXdiFiles(batchFile);
|
var xdiBatchFileExport = await CreateDirectoryXdiFiles(batchFile);
|
||||||
var result = await _fileOperationsApiService.AppendFile(request);
|
var result = await _fileOperationsApiService.AppendFile(request);
|
||||||
|
if (!result.IsSuccessful)
|
||||||
|
{
|
||||||
|
throw new Exception($"Failed to Append File: {batchFile.GetFileName}");
|
||||||
|
}
|
||||||
|
|
||||||
return xdiBatchFileExport;
|
return xdiBatchFileExport;
|
||||||
}
|
}
|
||||||
|
|
||||||
private AppendFileRequest BuildFileOperationsRequest(XdiBatchFile xdiBatchFile, string filePath)
|
private FileOperationsModels.AppendFileRequest BuildFileOperationsRequest(XdiBatchFile xdiBatchFile, string filePath)
|
||||||
{
|
{
|
||||||
var request = new AppendFileRequest()
|
var request = new FileOperationsModels.AppendFileRequest()
|
||||||
{
|
{
|
||||||
DestinationPath = filePath,
|
DestinationPath = filePath,
|
||||||
Extension = ".txt",
|
Extension = ".txt",
|
||||||
@@ -256,45 +264,5 @@ namespace LCU.API.Internal.MemberPreferencesApi.Services.XdiServices
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<XdiBatchProcessInfo> CreateNewBatchProcessInfo(int batchTotal)
|
|
||||||
{
|
|
||||||
var xdiBatchProcessInfo = new XdiBatchProcessInfo();
|
|
||||||
xdiBatchProcessInfo.StartTimeStamp = DateTime.Now;
|
|
||||||
xdiBatchProcessInfo.XdiBatchProcessStatus = XdiBatchProcessStatus.InProgress;
|
|
||||||
xdiBatchProcessInfo.BatchTotal = batchTotal;
|
|
||||||
return await _xdiBatchProcessInfoRepository.AddAsync(xdiBatchProcessInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<XdiBatchProcessInfo> UpdateBatchAsync(XdiBatchProcessInfo xdiBatchProcessInfo, XdiBatchProcessStatus xdiBatchStatus, string apiResponse)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var existing = await _xdiBatchProcessInfoRepository.FindByIdAsync(xdiBatchProcessInfo.XdiBatchProcessInfoId);
|
|
||||||
if (existing == null)
|
|
||||||
{
|
|
||||||
throw new ServiceException($"XdiBatchProcessInfo with XdiBatchProcessInfoId {xdiBatchProcessInfo.XdiBatchProcessInfoId} not found");
|
|
||||||
}
|
|
||||||
existing.XdiBatchProcessStatus = xdiBatchStatus;
|
|
||||||
existing.ApiResponse = apiResponse;
|
|
||||||
existing.EndTimeStamp = DateTime.Now;
|
|
||||||
|
|
||||||
await _xdiBatchProcessInfoRepository.UpdateAsync(existing);
|
|
||||||
await _unitOfWork.CompleteAsync();
|
|
||||||
return existing;
|
|
||||||
}
|
|
||||||
catch (SqlException sqlEx)
|
|
||||||
{
|
|
||||||
var message = $"Failure updating XdiBatchProcessInfo with XdiBatchProcessInfoId {xdiBatchProcessInfo.XdiBatchProcessInfoId}";
|
|
||||||
Log.Error(sqlEx, message);
|
|
||||||
throw new ServiceException(message);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var message = $"Failure updating XdiBatchProcessInfo with XdiBatchProcessInfoId {xdiBatchProcessInfo.XdiBatchProcessInfoId}";
|
|
||||||
Log.Error(ex, message);
|
|
||||||
throw new ServiceException(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
"AppendFile": "DirectFileOperations/AppendFile"
|
"AppendFile": "DirectFileOperations/AppendFile"
|
||||||
},
|
},
|
||||||
"CoreApiWrapperConfiguration": {
|
"CoreApiWrapperConfiguration": {
|
||||||
"CoreApiBaseUrl": "https://qa-core-api-wrapper-api.apps.azure.lcu-internal.com/api/core/",
|
"CoreApiBaseUrl": "https://localhost:44355/api/core/",
|
||||||
"CoreApiGetAgreementByUserId": "Agree/AgreementByUserId/{userId}",
|
"CoreApiGetAgreementByUserId": "Agree/AgreementByUserId/{userId}",
|
||||||
"CoreApiGetAgreementByAgreementId": "Agree/AgreementByAgreementId/{agreementId}",
|
"CoreApiGetAgreementByAgreementId": "Agree/AgreementByAgreementId/{agreementId}",
|
||||||
"CoreApiGetAgreementsByAccountId": "Agree/AgreementsByAccountId/{accountId}",
|
"CoreApiGetAgreementsByAccountId": "Agree/AgreementsByAccountId/{accountId}",
|
||||||
|
|||||||
-4
@@ -18,7 +18,6 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
|
|||||||
public DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
|
public DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
|
||||||
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
|
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
|
||||||
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
|
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
|
||||||
public DbSet<XdiBatchProcessInfo> XdiBatchProcessInfos { get; set; }
|
|
||||||
|
|
||||||
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||||
{
|
{
|
||||||
@@ -104,8 +103,5 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
|
|||||||
|
|
||||||
builder.Entity<DnaAuditProcess>().ToTable("DnaAuditProcess");
|
builder.Entity<DnaAuditProcess>().ToTable("DnaAuditProcess");
|
||||||
builder.Entity<DnaAuditProcess>().HasKey(p => p.ProcessId);
|
builder.Entity<DnaAuditProcess>().HasKey(p => p.ProcessId);
|
||||||
|
|
||||||
builder.Entity<XdiBatchProcessInfo>().ToTable("XdiBatchProcessInfo");
|
|
||||||
builder.Entity<XdiBatchProcessInfo>().HasKey(p => p.XdiBatchProcessInfoId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -11,7 +11,6 @@ public interface IApplicationDbContext : IAuditableChanges
|
|||||||
DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
|
DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
|
||||||
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
|
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
|
||||||
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
|
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
|
||||||
public DbSet<XdiBatchProcessInfo> XdiBatchProcessInfos { get; set; }
|
|
||||||
Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken());
|
Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken());
|
||||||
Task<int> SaveChangesWithOperatorAsync(string operatorId, DateTime dateAdded, UserType userType, CancellationToken cancellationToken);
|
Task<int> SaveChangesWithOperatorAsync(string operatorId, DateTime dateAdded, UserType userType, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
|
|||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
|
||||||
|
|
||||||
public interface IXdiBatchProcessInfoRepository: ICrudRepository<XdiBatchProcessInfo>
|
|
||||||
{
|
|
||||||
Task<IEnumerable<XdiBatchProcessInfo>> FindBatchProcessInfoByStatus(XdiBatchProcessStatus xdiProcessStatus);
|
|
||||||
}
|
|
||||||
-21
@@ -1,21 +0,0 @@
|
|||||||
using LCU.API.Internal.MemberPreferencesApiLib.Persistence;
|
|
||||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
|
|
||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace LCU.API.Internal.MemberPreferencesApiLib.Repositories;
|
|
||||||
|
|
||||||
public class XdiBatchProcessInfoRepository : CrudRepository<XdiBatchProcessInfo>, IXdiBatchProcessInfoRepository
|
|
||||||
{
|
|
||||||
private readonly IApplicationDbContext _context;
|
|
||||||
public XdiBatchProcessInfoRepository(ApplicationDbContext context) : base(context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<XdiBatchProcessInfo>> FindBatchProcessInfoByStatus(XdiBatchProcessStatus xdiProcessStatus)
|
|
||||||
{
|
|
||||||
return await _context.XdiBatchProcessInfos.Where(p => p.XdiBatchProcessStatus == xdiProcessStatus).ToListAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Operations Version="1.0" xmlns="http://schemas.microsoft.com/sqlserver/dac/Serialization/2012/02">
|
|
||||||
<Operation Name="Rename Refactor" Key="5c3556a6-05fd-442f-a0af-06c6e69d6a9d" ChangeDateTime="03/24/2026 00:12:28">
|
|
||||||
<Property Name="ElementName" Value="[dbo].[XdiBatchProcessInfo].[Id]" />
|
|
||||||
<Property Name="ElementType" Value="SqlSimpleColumn" />
|
|
||||||
<Property Name="ParentElementName" Value="[dbo].[XdiBatchProcessInfo]" />
|
|
||||||
<Property Name="ParentElementType" Value="SqlTable" />
|
|
||||||
<Property Name="NewName" Value="XdiBatchProcessInfoId" />
|
|
||||||
</Operation>
|
|
||||||
</Operations>
|
|
||||||
-4
@@ -63,9 +63,5 @@
|
|||||||
<Build Include="MemberOptInSettings.sql" />
|
<Build Include="MemberOptInSettings.sql" />
|
||||||
<Build Include="MemberPreference.sql" />
|
<Build Include="MemberPreference.sql" />
|
||||||
<Build Include="XdiBatchItems.sql" />
|
<Build Include="XdiBatchItems.sql" />
|
||||||
<Build Include="XdiBatchProcessInfo.sql" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<RefactorLog Include="LCU.API.Internal.MemberPreferencesApiSql.refactorlog" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
CREATE TABLE [dbo].[XdiBatchProcessInfo]
|
|
||||||
(
|
|
||||||
[XdiBatchProcessInfoId] [int] NOT NULL PRIMARY KEY IDENTITY,
|
|
||||||
[StartTimeStamp] DATETIME2 NOT NULL,
|
|
||||||
[EndTimeStamp] DATETIME2 NULL,
|
|
||||||
[BatchTotal] INT NOT NULL DEFAULT 0,
|
|
||||||
[ApiResponse] NVARCHAR(MAX) NULL,
|
|
||||||
[XdiBatchProcessStatus] INT NOT NULL
|
|
||||||
)
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
|
|
||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Entities
|
|
||||||
{
|
|
||||||
public class XdiBatchProcessInfo
|
|
||||||
{
|
|
||||||
[Key]
|
|
||||||
public int XdiBatchProcessInfoId { get; set; }
|
|
||||||
public DateTime StartTimeStamp { get; set; }
|
|
||||||
public DateTime EndTimeStamp { get; set; }
|
|
||||||
public XdiBatchProcessStatus XdiBatchProcessStatus { get; set; }
|
|
||||||
public int BatchTotal { get; set; }
|
|
||||||
public string ApiResponse { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-9
@@ -1,9 +0,0 @@
|
|||||||
namespace LCU.Library.Internal.MemberPreferencesApiModels.Enums
|
|
||||||
{
|
|
||||||
public enum XdiBatchProcessStatus
|
|
||||||
{
|
|
||||||
InProgress,
|
|
||||||
Failed,
|
|
||||||
Completed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
driver: secrets-store.csi.k8s.io
|
driver: secrets-store.csi.k8s.io
|
||||||
readOnly: true
|
readOnly: true
|
||||||
volumeAttributes:
|
volumeAttributes:
|
||||||
secretProviderClass: member-preferences-api-csi-key-vault-secrets-provider
|
secretProviderClass: normal-member-preferences-api-csi-key-vault-secrets-provider
|
||||||
|
|
||||||
- op: add
|
- op: add
|
||||||
path: /spec/template/spec/containers/0/volumeMounts/-
|
path: /spec/template/spec/containers/0/volumeMounts/-
|
||||||
|
|||||||
+1
-3
@@ -1,9 +1,7 @@
|
|||||||
{
|
{
|
||||||
"Primary": {
|
"Primary": {
|
||||||
"FeatureFlags": {
|
"FeatureFlags": {
|
||||||
"RunHostedServices": true,
|
"RunXdiBatchProcessConsumer": false,
|
||||||
"RunXdiBatchProcessConsumer": true,
|
|
||||||
"RunXdiSshResponseConsumer": true,
|
|
||||||
"RunDnaAuditProcessConsumer": false
|
"RunDnaAuditProcessConsumer": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
# This import was successfully run on 4/17/25
|
# This import was successfully run on 4/17/25
|
||||||
# Commenting it out so that the scheduled pipelines can run
|
# Commenting it out so that the scheduled pipelines can run
|
||||||
|
|
||||||
|
import {
|
||||||
|
to = azuredevops_git_repository.repositories["LCU.WebApps.Collections.RepoClient"]
|
||||||
|
id = "2aeafa30-011a-4751-8b26-ebf29243ae67/LCU.WebApps.Collections.RepoClient"
|
||||||
|
}
|
||||||
#import {
|
#import {
|
||||||
# to = azuredevops_git_repository.repositories["LCU.API.Internal.MaidBotApi"]
|
# to = azuredevops_git_repository.repositories["LCU.API.Internal.MaidBotApi"]
|
||||||
# id = "2aeafa30-011a-4751-8b26-ebf29243ae67/LCU.API.Internal.MaidBotApi"
|
# id = "2aeafa30-011a-4751-8b26-ebf29243ae67/LCU.API.Internal.MaidBotApi"
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ aks_workloads:
|
|||||||
- path: \AKS\maidbot-api
|
- path: \AKS\maidbot-api
|
||||||
repo: LCU.API.Internal.MaidBotApi
|
repo: LCU.API.Internal.MaidBotApi
|
||||||
environment: DB
|
environment: DB
|
||||||
|
- path: \AKS\repo-manager
|
||||||
|
repo: LCU.WebApps.Collections.RepoClient
|
||||||
|
|
||||||
environments:
|
environments:
|
||||||
- DB
|
- DB
|
||||||
|
|||||||
Reference in New Issue
Block a user