Adding
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public abstract class BaseRepository
|
||||
{
|
||||
protected readonly AppDbContext _context;
|
||||
|
||||
public BaseRepository(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
_context.Database.SetCommandTimeout(TimeSpan.FromSeconds(45));
|
||||
}
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class DocumentProcessingInfoRepository : BaseRepository, IDocumentProcessingInfoRepository
|
||||
{
|
||||
public DocumentProcessingInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindAsync()
|
||||
{
|
||||
return await _context.DocumentProcessingInfos.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<DocumentProcessingInfo> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos
|
||||
.FirstOrDefaultAsync(documentProcessingInfo => documentProcessingInfo.DocumentProcessingInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindListByIdAsync(List<int> ids)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos
|
||||
.Where(documentProcessingInfo => ids.Contains(documentProcessingInfo.DocumentProcessingInfoId))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindByIngestorRunInfoIdAsync(Guid ingestorRunInfoId)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos
|
||||
.Where(documentProcessingInfo => documentProcessingInfo.IngestorRunInfoId == ingestorRunInfoId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindByProcessStatusTypeAsync(ProcessStatusTypes statusType, bool? isUnknown)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos
|
||||
.Where(documentProcessingInfo => documentProcessingInfo.StatusType.Equals(statusType)
|
||||
&& (isUnknown == null || documentProcessingInfo.EntityUnknown.Equals(isUnknown)))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindByProcessStatusTypeListAsync(List<ProcessStatusTypes> statusTypes, bool? isUnknown)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos
|
||||
.Where(documentProcessingInfo => statusTypes.Contains(documentProcessingInfo.StatusType) &&
|
||||
(isUnknown == null || documentProcessingInfo.EntityUnknown == isUnknown))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindCompletedFirstPassByIngestorRunInfoIdAsync(Guid ingestorRunInfoId)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos.Where(documentProcessingInfo =>
|
||||
documentProcessingInfo.IngestorRunInfoId.Equals(ingestorRunInfoId) &&
|
||||
documentProcessingInfo.ProcessCount >= 1
|
||||
).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<DocumentProcessingInfo> AddAsync(DocumentProcessingInfo documentProcessingInfo)
|
||||
{
|
||||
var result = await _context.DocumentProcessingInfos.AddAsync(documentProcessingInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task AddRangeAsync(DocumentProcessingInfo[] documentProcessingInfos)
|
||||
{
|
||||
await _context.DocumentProcessingInfos.AddRangeAsync(documentProcessingInfos);
|
||||
}
|
||||
|
||||
public void Update(DocumentProcessingInfo documentProcessingInfo)
|
||||
{
|
||||
_context.DocumentProcessingInfos.Update(documentProcessingInfo);
|
||||
}
|
||||
|
||||
public void UpdateRange(List<DocumentProcessingInfo> documentProcessingInfos)
|
||||
{
|
||||
_context.DocumentProcessingInfos.UpdateRange(documentProcessingInfos);
|
||||
}
|
||||
|
||||
public void Remove(DocumentProcessingInfo documentProcessingInfo)
|
||||
{
|
||||
_context.DocumentProcessingInfos.Remove(documentProcessingInfo);
|
||||
}
|
||||
|
||||
public async Task<PagedResult<DocumentProcessingInfo>> FilteredListAsync(Filter filter)
|
||||
{
|
||||
var results = new PagedResult<DocumentProcessingInfo>();
|
||||
var skip = (filter.Page - 1) * filter.Limit;
|
||||
|
||||
results.Total = await _context.DocumentProcessingInfos
|
||||
.IncludeAll()
|
||||
.IncludeFilters(filter)
|
||||
.CountAsync();
|
||||
|
||||
results.Items = await _context.DocumentProcessingInfos
|
||||
.IncludeAll()
|
||||
.IncludeFilters(filter)
|
||||
.OrderBySortableFields(filter)
|
||||
.Skip(skip)
|
||||
.Take(filter.Limit)
|
||||
.ToArrayAsync();
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<int> CountCompletedFirstPassByIngestorRunInfoIdAsync(Guid ingestorRunInfoId)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos.CountAsync(documentProcessingInfo =>
|
||||
documentProcessingInfo.IngestorRunInfoId.Equals(ingestorRunInfoId) &&
|
||||
documentProcessingInfo.ProcessCount >= 1
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<int> CountCompletedByIngestorRunInfoIdAsync(Guid ingestorRunInfoId)
|
||||
{
|
||||
return await _context.DocumentProcessingInfos.CountAsync(documentProcessingInfo =>
|
||||
documentProcessingInfo.IngestorRunInfoId.Equals(ingestorRunInfoId) &&
|
||||
documentProcessingInfo.StatusType == ProcessStatusTypes.Completed
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<DocumentProcessingInfo>> FindByDocumentIdsAsync(Guid[] ids)
|
||||
=> await _context.DocumentProcessingInfos.Where(i => i.DocumentId != null && ids.Contains(i.DocumentId.Value)).ToArrayAsync();
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class DocumentTypeArchiveDeleteInfoRepository : BaseRepository, IDocumentTypeArchiveDeleteInfoRepository
|
||||
{
|
||||
public DocumentTypeArchiveDeleteInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<DocumentTypeArchiveDeleteInfo>> FindAsync()
|
||||
{
|
||||
return await _context.DocumentTypeArchiveDeleteInfos.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<DocumentTypeArchiveDeleteInfo> FindByDocumentTypeNameAsync(string documentTypesName)
|
||||
{
|
||||
return await _context.DocumentTypeArchiveDeleteInfos
|
||||
.FirstOrDefaultAsync(documentTypeArchiveDeleteInfo => documentTypeArchiveDeleteInfo.DocumentTypeName == documentTypesName);
|
||||
}
|
||||
|
||||
public async Task<DocumentTypeArchiveDeleteInfo> AddAsync(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo)
|
||||
{
|
||||
var result = await _context.DocumentTypeArchiveDeleteInfos.AddAsync(documentTypeArchiveDeleteInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo)
|
||||
{
|
||||
_context.DocumentTypeArchiveDeleteInfos.Update(documentTypeArchiveDeleteInfo);
|
||||
}
|
||||
|
||||
public void Remove(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo)
|
||||
{
|
||||
_context.DocumentTypeArchiveDeleteInfos.Remove(documentTypeArchiveDeleteInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IDocumentProcessingInfoRepository
|
||||
{
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindAsync();
|
||||
Task<DocumentProcessingInfo> FindByIdAsync(int id);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindListByIdAsync(List<int> ids);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindByIngestorRunInfoIdAsync(Guid ingestorRunInfoId);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindByProcessStatusTypeAsync(ProcessStatusTypes statusType, bool? isUnknown);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindByProcessStatusTypeListAsync(List<ProcessStatusTypes> statusTypes, bool? isUnknown);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindCompletedFirstPassByIngestorRunInfoIdAsync(Guid ingestorRunInfoId);
|
||||
Task<DocumentProcessingInfo> AddAsync(DocumentProcessingInfo documentProcessingInfo);
|
||||
Task AddRangeAsync(DocumentProcessingInfo[] documentProcessingInfos);
|
||||
void Update(DocumentProcessingInfo documentProcessingInfo);
|
||||
void UpdateRange(List<DocumentProcessingInfo> documentProcessingInfos);
|
||||
void Remove(DocumentProcessingInfo documentProcessingInfo);
|
||||
Task<PagedResult<DocumentProcessingInfo>> FilteredListAsync(Filter filter);
|
||||
Task<int> CountCompletedFirstPassByIngestorRunInfoIdAsync(Guid ingestorRunInfoId);
|
||||
Task<int> CountCompletedByIngestorRunInfoIdAsync(Guid ingestorRunInfoId);
|
||||
Task<IEnumerable<DocumentProcessingInfo>> FindByDocumentIdsAsync(Guid[] ids);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IDocumentTypeArchiveDeleteInfoRepository
|
||||
{
|
||||
Task<IEnumerable<DocumentTypeArchiveDeleteInfo>> FindAsync();
|
||||
Task<DocumentTypeArchiveDeleteInfo> FindByDocumentTypeNameAsync(string documentType);
|
||||
Task<DocumentTypeArchiveDeleteInfo> AddAsync(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo);
|
||||
void Update(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo);
|
||||
void Remove(DocumentTypeArchiveDeleteInfo documentTypeArchiveDeleteInfo);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IIngestorRunInfoRepository
|
||||
{
|
||||
Task<IngestorRunInfo> FindByIdAsync(Guid id);
|
||||
Task<List<IngestorRunInfo>> FindListByIdAsync(List<Guid> ids);
|
||||
Task<IngestorRunInfo> AddAsync(IngestorRunInfo ingestorRunInfo);
|
||||
void Update(IngestorRunInfo ingestorRunInfo);
|
||||
void Remove(IngestorRunInfo ingestorRunInfo);
|
||||
IEnumerable<IngestorRunInfo> FindByIngestionEndDateNotArchived(DateTime ingestionEndDate);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories;
|
||||
|
||||
public interface IMemberNotificationInfoRepository
|
||||
{
|
||||
Task<IEnumerable<MemberNotificationInfo>> FindAsync();
|
||||
Task<MemberNotificationInfo> FindByIdAsync(int id);
|
||||
Task<IEnumerable<MemberNotificationInfo>> FindListByIdAsync(List<int> ids);
|
||||
Task<IEnumerable<MemberNotificationInfo>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId);
|
||||
Task<IEnumerable<MemberNotificationInfo>> FindByNotificationStatusAsync(NotificationStatusTypes status);
|
||||
Task<IEnumerable<MemberNotificationInfo>> FindSendableMemberNotificationsAsync(DateTime minimumUploadDate, int maxAttempts);
|
||||
Task<MemberNotificationInfo> AddAsync(MemberNotificationInfo memberNotificationInfo);
|
||||
Task AddListAsync(List<MemberNotificationInfo> memberNotificationInfos);
|
||||
void Update(MemberNotificationInfo memberNotificationInfo);
|
||||
void UpdateRange(IEnumerable<MemberNotificationInfo> memberNotificationInfos);
|
||||
void Remove(MemberNotificationInfo memberNotificationInfo);
|
||||
Task<IEnumerable<MemberNotificationInfo>> GetMemberNotificationInfosByFilter(Filter filter);
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories;
|
||||
|
||||
public interface IOsgPreprocessorInfoRepository
|
||||
{
|
||||
Task<IEnumerable<OsgPreprocessorInfo>> FindAsync();
|
||||
Task<OsgPreprocessorInfo> FindByIdAsync(int id);
|
||||
Task<IEnumerable<OsgPreprocessorInfo>> FindListByIdAsync(List<int> ids);
|
||||
Task<IEnumerable<OsgPreprocessorInfo>> FindByDocumentType(string documentType);
|
||||
Task<IEnumerable<OsgPreprocessorInfo>> FindByMemberNumber(string memberNumber);
|
||||
Task<OsgPreprocessorInfo> AddAsync(OsgPreprocessorInfo osgPreprocessorInfo);
|
||||
Task AddListAsync(List<OsgPreprocessorInfo> osgPreprocessorInfos);
|
||||
void Update(OsgPreprocessorInfo osgPreprocessorInfo);
|
||||
void UpdateRange(IEnumerable<OsgPreprocessorInfo> osgPreprocessorInfos);
|
||||
void Remove(OsgPreprocessorInfo osgPreprocessorInfo);
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IOwnerOverrideInfoRepository
|
||||
{
|
||||
Task<IEnumerable<OwnerOverrideInfo>> FindAsync();
|
||||
Task<OwnerOverrideInfo> FindByIdAsync(int id);
|
||||
Task<IEnumerable<OwnerOverrideInfo>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId);
|
||||
Task<OwnerOverrideInfo> AddAsync(OwnerOverrideInfo ownerOverrideInfo);
|
||||
void Update(OwnerOverrideInfo ownerOverrideInfo);
|
||||
void Remove(OwnerOverrideInfo ownerOverrideInfo);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IPdfPartitionerLogRepository
|
||||
{
|
||||
Task<IEnumerable<PdfPartitionerLog>> FindAsync();
|
||||
Task<PdfPartitionerLog> FindByIdAsync(int id);
|
||||
Task<IEnumerable<PdfPartitionerLog>> FindByPdfPartitionerRunInfoIdAsync(Guid pdfPartitionerRunInfoId);
|
||||
Task AddRangeAsync(IEnumerable<PdfPartitionerLog> pdfPartitionerLogs);
|
||||
Task<PdfPartitionerLog> AddAsync(PdfPartitionerLog pdfPartitionerLog);
|
||||
void Remove(PdfPartitionerLog pdfPartitionerLog);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IPdfPartitionerRunInfoRepository
|
||||
{
|
||||
Task<PdfPartitionerRunInfo> FindByIdAsync(Guid id);
|
||||
Task<PdfPartitionerRunInfo> AddAsync(PdfPartitionerRunInfo pdfPartitionerRunInfo);
|
||||
void Update(PdfPartitionerRunInfo pdfPartitionerRunInfo);
|
||||
void Remove(PdfPartitionerRunInfo pdfPartitionerRunInfo);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IProcessingLogRepository
|
||||
{
|
||||
Task<IEnumerable<ProcessingLog>> FindAsync();
|
||||
Task<ProcessingLog> FindByIdAsync(int id);
|
||||
Task<IEnumerable<ProcessingLog>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId);
|
||||
Task<ProcessingLog> AddAsync(ProcessingLog processingLog);
|
||||
Task AddRangeAsync(IEnumerable<ProcessingLog> processingLogs);
|
||||
void Update(ProcessingLog processingLog);
|
||||
void Remove(ProcessingLog processingLog);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
{
|
||||
Task CompleteAsync();
|
||||
void Complete();
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class IngestorRunInfoRepository : BaseRepository, IIngestorRunInfoRepository
|
||||
{
|
||||
public IngestorRunInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IngestorRunInfo> FindByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.IngestorRunInfos.FirstOrDefaultAsync(ingestorRunInfo => ingestorRunInfo.IngestorRunInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<List<IngestorRunInfo>> FindListByIdAsync(List<Guid> ids)
|
||||
{
|
||||
return await _context.IngestorRunInfos.Where(ingestorRunInfo => ids.Contains(ingestorRunInfo.IngestorRunInfoId)).ToListAsync();
|
||||
}
|
||||
|
||||
public IEnumerable<IngestorRunInfo> FindByIngestionEndDateNotArchived(DateTime ingestionEndDate)
|
||||
{
|
||||
return _context.IngestorRunInfos.Where(ingestionRunInfo =>
|
||||
ingestionRunInfo.EndTimeStamp < ingestionEndDate && ingestionRunInfo.ArchiveTimeStamp == null);
|
||||
}
|
||||
|
||||
public async Task<IngestorRunInfo> AddAsync(IngestorRunInfo ingestorRunInfo)
|
||||
{
|
||||
var result = await _context.IngestorRunInfos.AddAsync(ingestorRunInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(IngestorRunInfo ingestorRunInfo)
|
||||
{
|
||||
_context.IngestorRunInfos.Update(ingestorRunInfo);
|
||||
}
|
||||
|
||||
public void Remove(IngestorRunInfo ingestorRunInfo)
|
||||
{
|
||||
_context.IngestorRunInfos.Remove(ingestorRunInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Enums;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories;
|
||||
|
||||
public class MemberNotificationInfoRepository : BaseRepository, IMemberNotificationInfoRepository
|
||||
{
|
||||
public MemberNotificationInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> FindAsync()
|
||||
{
|
||||
return await _context.MemberNotificationInfos.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<MemberNotificationInfo> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.MemberNotificationInfos
|
||||
.FirstOrDefaultAsync(memberNotificationInfo => memberNotificationInfo.MemberNotificationInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> FindListByIdAsync(List<int> ids)
|
||||
{
|
||||
return await _context.MemberNotificationInfos
|
||||
.Where(memberNotificationInfo => ids.Contains(memberNotificationInfo.MemberNotificationInfoId))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId)
|
||||
{
|
||||
return await _context.MemberNotificationInfos
|
||||
.Where(memberNotificationInfo => documentProcessingInfoId == memberNotificationInfo.DocumentProcessingInfoId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> FindByNotificationStatusAsync(NotificationStatusTypes status)
|
||||
{
|
||||
return await _context.MemberNotificationInfos
|
||||
.Where(memberNotificationInfo => status == memberNotificationInfo.NotificationStatusType)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> FindSendableMemberNotificationsAsync(DateTime minimumUploadDate, int maxAttempts)
|
||||
{
|
||||
return await _context.MemberNotificationInfos
|
||||
.Where(memberNotificationInfo =>
|
||||
memberNotificationInfo.UploadDate <= minimumUploadDate &&
|
||||
memberNotificationInfo.Attempts <= maxAttempts &&
|
||||
memberNotificationInfo.DeliveryMethod != DeliveryMethod.Paper &&
|
||||
memberNotificationInfo.NotificationStatusType == NotificationStatusTypes.Pending ||
|
||||
memberNotificationInfo.NotificationStatusType == NotificationStatusTypes.Failure)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<MemberNotificationInfo> AddAsync(MemberNotificationInfo memberNotificationInfo)
|
||||
{
|
||||
var result = await _context.MemberNotificationInfos.AddAsync(memberNotificationInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task AddListAsync(List<MemberNotificationInfo> memberNotificationInfos)
|
||||
{
|
||||
await _context.MemberNotificationInfos.AddRangeAsync(memberNotificationInfos);
|
||||
}
|
||||
|
||||
public void Update(MemberNotificationInfo memberNotificationInfo)
|
||||
{
|
||||
_context.MemberNotificationInfos.Update(memberNotificationInfo);
|
||||
}
|
||||
|
||||
public void UpdateRange(IEnumerable<MemberNotificationInfo> memberNotificationInfos)
|
||||
{
|
||||
_context.MemberNotificationInfos.UpdateRange(memberNotificationInfos);
|
||||
}
|
||||
|
||||
public void Remove(MemberNotificationInfo memberNotificationInfo)
|
||||
{
|
||||
_context.MemberNotificationInfos.Remove(memberNotificationInfo);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MemberNotificationInfo>> GetMemberNotificationInfosByFilter(Filter filter)
|
||||
{
|
||||
var query = _context.DocumentProcessingInfos
|
||||
.IncludeFilters(filter)
|
||||
.Include(documentProcessingInfo => documentProcessingInfo.MemberNotificationInfos)
|
||||
.Where(x => x.MemberNotificationInfos.Any())
|
||||
.SelectMany(x => x.MemberNotificationInfos);
|
||||
|
||||
if (filter.NotificationStatusFilters != null)
|
||||
{
|
||||
if (filter.NotificationStatusFilters.Any())
|
||||
{
|
||||
query = query.Where(memberNotificationInfo =>
|
||||
filter.NotificationStatusFilters.Contains(memberNotificationInfo.NotificationStatusType));
|
||||
}
|
||||
}
|
||||
|
||||
return await query.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories;
|
||||
|
||||
[Obsolete("06/02/2023 - Used to prepare historical documents for ingestion. No longer in use.")]
|
||||
public class OsgPreprocessorInfoRepository : BaseRepository, IOsgPreprocessorInfoRepository
|
||||
{
|
||||
public OsgPreprocessorInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<OsgPreprocessorInfo>> FindAsync()
|
||||
{
|
||||
return await _context.OsgPreprocessorInfos.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<OsgPreprocessorInfo> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.OsgPreprocessorInfos
|
||||
.FirstOrDefaultAsync(osgPreprocessorInfo => osgPreprocessorInfo.OsgPreprocessorInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OsgPreprocessorInfo>> FindListByIdAsync(List<int> ids)
|
||||
{
|
||||
return await _context.OsgPreprocessorInfos
|
||||
.Where(osgPreprocessorInfo => ids.Contains(osgPreprocessorInfo.OsgPreprocessorInfoId))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OsgPreprocessorInfo>> FindByDocumentType(string documentType)
|
||||
{
|
||||
return await _context.OsgPreprocessorInfos
|
||||
.Where(osgPreprocessorInfo => documentType == osgPreprocessorInfo.DocumentType)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OsgPreprocessorInfo>> FindByMemberNumber(string memberNumber)
|
||||
{
|
||||
return await _context.OsgPreprocessorInfos
|
||||
.Where(osgPreprocessorInfo => memberNumber == osgPreprocessorInfo.MemberNumber)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<OsgPreprocessorInfo> AddAsync(OsgPreprocessorInfo osgPreprocessorInfo)
|
||||
{
|
||||
var result = await _context.OsgPreprocessorInfos.AddAsync(osgPreprocessorInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task AddListAsync(List<OsgPreprocessorInfo> osgPreprocessorInfos)
|
||||
{
|
||||
await _context.OsgPreprocessorInfos.AddRangeAsync(osgPreprocessorInfos);
|
||||
}
|
||||
|
||||
public void Update(OsgPreprocessorInfo osgPreprocessorInfo)
|
||||
{
|
||||
_context.OsgPreprocessorInfos.Update(osgPreprocessorInfo);
|
||||
}
|
||||
|
||||
public void UpdateRange(IEnumerable<OsgPreprocessorInfo> osgPreprocessorInfos)
|
||||
{
|
||||
_context.OsgPreprocessorInfos.UpdateRange(osgPreprocessorInfos);
|
||||
}
|
||||
|
||||
public void Remove(OsgPreprocessorInfo osgPreprocessorInfo)
|
||||
{
|
||||
_context.OsgPreprocessorInfos.Remove(osgPreprocessorInfo);
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class OwnerOverrideInfoRepository : BaseRepository, IOwnerOverrideInfoRepository
|
||||
{
|
||||
public OwnerOverrideInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<OwnerOverrideInfo>> FindAsync()
|
||||
{
|
||||
return await _context.OwnerOverrideInfos.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<OwnerOverrideInfo> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.OwnerOverrideInfos
|
||||
.FirstOrDefaultAsync(ownerOverrideInfo => ownerOverrideInfo.OwnerOverrideInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<OwnerOverrideInfo>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId)
|
||||
{
|
||||
return await _context.OwnerOverrideInfos
|
||||
.Where(ownerOverrideInfo => ownerOverrideInfo.DocumentProcessingInfoId.ToString().Equals(documentProcessingInfoId.ToString()))
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<OwnerOverrideInfo> AddAsync(OwnerOverrideInfo ownerOverrideInfo)
|
||||
{
|
||||
var result = await _context.OwnerOverrideInfos.AddAsync(ownerOverrideInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(OwnerOverrideInfo ownerOverrideInfo)
|
||||
{
|
||||
_context.OwnerOverrideInfos.Update(ownerOverrideInfo);
|
||||
}
|
||||
|
||||
public void Remove(OwnerOverrideInfo ownerOverrideInfo)
|
||||
{
|
||||
_context.OwnerOverrideInfos.Remove(ownerOverrideInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class PdfPartitionerLogRepository : BaseRepository, IPdfPartitionerLogRepository
|
||||
{
|
||||
public PdfPartitionerLogRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<PdfPartitionerLog>> FindAsync()
|
||||
{
|
||||
return await _context.PdfPartitionerLogs.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PdfPartitionerLog> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.PdfPartitionerLogs
|
||||
.FirstOrDefaultAsync(pdfPartitionerLog => pdfPartitionerLog.PdfPartitionerLogId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<PdfPartitionerLog>> FindByPdfPartitionerRunInfoIdAsync(Guid pdfPartitionerRunInfoId)
|
||||
{
|
||||
return await _context.PdfPartitionerLogs
|
||||
.Where(pdfPartitionerLog => pdfPartitionerLog.PdfPartitionerRunInfoId == pdfPartitionerRunInfoId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddRangeAsync(IEnumerable<PdfPartitionerLog> pdfPartitionerLogs)
|
||||
{
|
||||
await _context.PdfPartitionerLogs.AddRangeAsync(pdfPartitionerLogs);
|
||||
}
|
||||
|
||||
public async Task<PdfPartitionerLog> AddAsync(PdfPartitionerLog pdfPartitionerLog)
|
||||
{
|
||||
var result = await _context.PdfPartitionerLogs.AddAsync(pdfPartitionerLog);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Remove(PdfPartitionerLog pdfPartitionerLog)
|
||||
{
|
||||
_context.PdfPartitionerLogs.Remove(pdfPartitionerLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class PdfPartitionerRunInfoRepository : BaseRepository, IPdfPartitionerRunInfoRepository
|
||||
{
|
||||
public PdfPartitionerRunInfoRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<PdfPartitionerRunInfo> FindByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.PdfPartitionerRunInfos.FirstOrDefaultAsync(pdfPartitionerRunInfo => pdfPartitionerRunInfo.PdfPartitionerRunInfoId == id);
|
||||
}
|
||||
|
||||
public async Task<PdfPartitionerRunInfo> AddAsync(PdfPartitionerRunInfo pdfPartitionerRunInfo)
|
||||
{
|
||||
var result = await _context.PdfPartitionerRunInfos.AddAsync(pdfPartitionerRunInfo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(PdfPartitionerRunInfo pdfPartitionerRunInfo)
|
||||
{
|
||||
_context.PdfPartitionerRunInfos.Update(pdfPartitionerRunInfo);
|
||||
}
|
||||
|
||||
public void Remove(PdfPartitionerRunInfo pdfPartitionerRunInfo)
|
||||
{
|
||||
_context.PdfPartitionerRunInfos.Remove(pdfPartitionerRunInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class ProcessingLogRepository : BaseRepository, IProcessingLogRepository
|
||||
{
|
||||
public ProcessingLogRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<ProcessingLog>> FindAsync()
|
||||
{
|
||||
return await _context.ProcessingLogs.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<ProcessingLog> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.ProcessingLogs
|
||||
.FirstOrDefaultAsync(processingLog => processingLog.ProcessingLogId == id);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ProcessingLog>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId)
|
||||
{
|
||||
return await _context.ProcessingLogs
|
||||
.Where(processingLog => processingLog.DocumentProcessingInfoId == documentProcessingInfoId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<ProcessingLog> AddAsync(ProcessingLog processingLog)
|
||||
{
|
||||
var result = await _context.ProcessingLogs.AddAsync(processingLog);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task AddRangeAsync(IEnumerable<ProcessingLog> processingLogs)
|
||||
{
|
||||
await _context.ProcessingLogs.AddRangeAsync(processingLogs);
|
||||
}
|
||||
|
||||
public void Update(ProcessingLog processingLog)
|
||||
{
|
||||
_context.ProcessingLogs.Update(processingLog);
|
||||
}
|
||||
|
||||
public void Remove(ProcessingLog processingLog)
|
||||
{
|
||||
_context.ProcessingLogs.Remove(processingLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
||||
{
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
|
||||
public UnitOfWork(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task CompleteAsync()
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public void Complete()
|
||||
{
|
||||
_context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user