This commit is contained in:
Zeeshaun
2026-04-07 13:11:39 -05:00
parent d9931b3c36
commit e37826fe30
184 changed files with 2192 additions and 2196 deletions
@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LCU.Library.Internal.LcuClassPatterns.Crud" Version="1.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
@@ -18,6 +18,7 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
public DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
public DbSet<XdiBatchProcessInfo> XdiBatchProcessInfos { get; set; }
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
{
@@ -103,5 +104,8 @@ public class ApplicationDbContext : DbContext, IApplicationDbContext
builder.Entity<DnaAuditProcess>().ToTable("DnaAuditProcess");
builder.Entity<DnaAuditProcess>().HasKey(p => p.ProcessId);
builder.Entity<XdiBatchProcessInfo>().ToTable("XdiBatchProcessInfo");
builder.Entity<XdiBatchProcessInfo>().HasKey(p => p.XdiBatchProcessInfoId);
}
}
@@ -11,6 +11,7 @@ public interface IApplicationDbContext : IAuditableChanges
DbSet<MemberOptInSettings> MemberOptInSettings { get; set; }
public DbSet<XdiBatchItem> XdiBatchItems { get; set; }
public DbSet<DnaAuditProcess> DnaAuditProcesses { get; set; }
public DbSet<XdiBatchProcessInfo> XdiBatchProcessInfos { get; set; }
Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken());
Task<int> SaveChangesWithOperatorAsync(string operatorId, DateTime dateAdded, UserType userType, CancellationToken cancellationToken);
}
@@ -1,5 +1,6 @@
using LCU.API.Internal.MemberPreferencesApiLib.Persistence;
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
using Microsoft.EntityFrameworkCore;
namespace LCU.API.Internal.MemberPreferencesApiLib.Repositories;
@@ -15,6 +16,11 @@ public class DnaAuditProcessRepository : BaseRepository, IDnaAuditProcessReposit
return await _context.DnaAuditProcesses.ToListAsync();
}
public async Task<DnaAuditProcess> GetDnaAuditProcessByDnaProcessType(DnaAuditProcessType type)
{
return await _context.DnaAuditProcesses.Where(d => d.DnaProcessType == type).FirstOrDefaultAsync();
}
public async Task Update(DnaAuditProcess existing)
{
_context.DnaAuditProcesses.Update(existing);
@@ -1,9 +1,11 @@
using LCU.Library.Internal.MemberPreferencesApiModels.Entities;
using LCU.Library.Internal.MemberPreferencesApiModels.Enums;
namespace LCU.API.Internal.MemberPreferencesApiLib.Repositories;
public interface IDnaAuditProcessRepository
{
Task<IReadOnlyCollection<DnaAuditProcess>> GetAllDnaAuditProcesses();
Task<DnaAuditProcess> GetDnaAuditProcessByDnaProcessType(DnaAuditProcessType type);
Task Update(DnaAuditProcess existing);
}
@@ -8,6 +8,7 @@ public interface IXdiBatchItemsRepository
Task<IReadOnlyCollection<XdiBatchItem>> GetXdiBatchItems();
Task<IReadOnlyCollection<XdiBatchItem>> GetNewXdiBatchItems();
Task<XdiBatchItem> SaveAsync(XdiBatchItem batchItem);
Task<List<XdiBatchItem>> SaveRangeAsync(List<XdiBatchItem> batchItemList);
Task<XdiBatchItem> FindExistingItem(string memberId, BatchState batchState);
void Update(XdiBatchItem existing);
void Delete(XdiBatchItem item);
@@ -0,0 +1,10 @@
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);
}
@@ -27,6 +27,12 @@ public class XdiBatchItemsRepository : BaseRepository, IXdiBatchItemsRepository
return batchItem;
}
public async Task<List<XdiBatchItem>> SaveRangeAsync(List<XdiBatchItem> batchItemList)
{
await _context.XdiBatchItems.AddRangeAsync(batchItemList);
return batchItemList;
}
public async Task<XdiBatchItem> FindExistingItem(string userId, BatchState batchState)
{
return await _context.XdiBatchItems.Where(p => p.UserId == userId && p.BatchState == batchState)
@@ -0,0 +1,21 @@
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();
}
}