Adding
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Exceptions
|
||||
{
|
||||
public class ArchiveException : Exception
|
||||
{
|
||||
public ArchiveException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ArchiveException(string message, Exception exception) : base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Extensions;
|
||||
|
||||
public static class FilterNullsAndZerosOrDefaultExtension
|
||||
{
|
||||
public static string[] FilterNullsAndZerosOrDefault(this IEnumerable<string> list)
|
||||
{
|
||||
var filteredList = list?.Where(x =>
|
||||
!string.IsNullOrWhiteSpace(x) && int.Parse(x) != 0
|
||||
).ToList();
|
||||
if (filteredList == null || !filteredList.Any())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return filteredList.ToArray();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using System;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class DocumentProcessingInfoCreatedDateQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterByCreatedDate(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.CreatedDateStart == null && filter?.CreatedDateEnd == null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
if (filter?.CreatedDateStart == null)
|
||||
{
|
||||
filter.CreatedDateStart = DateTime.MinValue;
|
||||
}
|
||||
|
||||
if (filter?.CreatedDateEnd == null || filter?.CreatedDateEnd == DateTime.MinValue)
|
||||
{
|
||||
filter.CreatedDateEnd = DateTime.MaxValue;
|
||||
}
|
||||
|
||||
return queryable.Where(DocumentProcessingInfo => DocumentProcessingInfo.CreatedDate >= filter.CreatedDateStart &&
|
||||
DocumentProcessingInfo.CreatedDate <= filter.CreatedDateEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class DocumentProcessingInfoDocBusinessNameQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterDocBusinessName(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.DocBusinessName == null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
return queryable.Where(documentProcessingInfo => documentProcessingInfo.DocumentBusinessName.Contains(filter.DocBusinessName));
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class DocumentProcessingInfoDocTypeQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterDocType(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.DocType == null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
var filterDocType = Regex.Replace(filter.DocType, @"\s", "");
|
||||
|
||||
return queryable.Where(documentProcessingInfo => documentProcessingInfo.DocumentType.Contains(filterDocType));
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using System.Linq;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables;
|
||||
|
||||
public static class DocumentProcessingInfoIndexJsonEqualsFilter
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterByIndexFileJsonKeyValueEquals(
|
||||
this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.CustomIndexFileFiltersEquals is null) return queryable;
|
||||
|
||||
var result = queryable;
|
||||
foreach (var indexFilter in filter.CustomIndexFileFiltersEquals)
|
||||
{
|
||||
result = result.Where(d => AppDbContext.JSON_VALUE(d.DocumentValuePayload, "$." + indexFilter.Key) == indexFilter.Value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables;
|
||||
|
||||
public static class DocumentProcessingInfoIndexJsonLikeOrFilter
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterByIndexFileJsonKeyValueLikeOr(
|
||||
this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.CustomIndexFileFiltersLikeOr is null) return queryable;
|
||||
|
||||
var result = queryable;
|
||||
|
||||
Expression<Func<DocumentProcessingInfo, bool>> predicate = f => false;
|
||||
foreach (var indexFilter in filter.CustomIndexFileFiltersLikeOr)
|
||||
{
|
||||
Expression<Func<DocumentProcessingInfo, bool>> expression = d =>
|
||||
EF.Functions.Like(AppDbContext.JSON_VALUE(d.DocumentValuePayload, "$." + indexFilter.Key),
|
||||
$"%{indexFilter.Value.Replace(" ", "%")}%");
|
||||
var invokedExpr = Expression.Invoke(expression, predicate.Parameters);
|
||||
|
||||
predicate = Expression.Lambda<Func<DocumentProcessingInfo, bool>>(Expression.OrElse(predicate.Body, invokedExpr),
|
||||
predicate.Parameters);
|
||||
}
|
||||
|
||||
result = result.Where(predicate);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class DocumentProcessingInfoIngestorRunInfoIdQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterIngestorRunInfoId(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter.IngestorRunInfoId == null)
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
return queryable.Where(documentProcessingInfo => documentProcessingInfo.IngestorRunInfoId == filter.IngestorRunInfoId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables;
|
||||
|
||||
public static class DocumentProcessingInfoNotificationStatusQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterByNotificationStatusType
|
||||
(
|
||||
this IQueryable<DocumentProcessingInfo> queryable,
|
||||
Filter filter
|
||||
) => filter?.NotificationStatusFilters is { Count: > 0 } statusFilter
|
||||
? queryable
|
||||
.Where(q => q.MemberNotificationInfos != null)
|
||||
.Where(q => q.MemberNotificationInfos.Any(m => statusFilter.Contains(m.NotificationStatusType)))
|
||||
: queryable;
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class DocumentProcessingInfoStatusTypeQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> FilterByStatusType(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.StatusFilters == null || !filter.StatusFilters.Any())
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
var enabledStatusFilters = filter.StatusFilters.Where(statusFilter => statusFilter.IsEnabled).ToList();
|
||||
|
||||
var unknownStatusTypes = enabledStatusFilters.Where(status => status.IsUnknown).Select(status => status.StatusType);
|
||||
var knownStatusTypes = enabledStatusFilters.Where(status => !status.IsUnknown).Select(status => status.StatusType);
|
||||
|
||||
return queryable.Where(documentProcessingInfo =>
|
||||
(documentProcessingInfo.EntityUnknown && unknownStatusTypes.Contains(documentProcessingInfo.StatusType)) ||
|
||||
(!documentProcessingInfo.EntityUnknown && knownStatusTypes.Contains(documentProcessingInfo.StatusType))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class IncludeAllQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> IncludeAll(this IQueryable<DocumentProcessingInfo> queryable)
|
||||
{
|
||||
return queryable.Include(documentProcessingInfo => documentProcessingInfo.IngestorRunInfo)
|
||||
.Include(documentProcessingInfo => documentProcessingInfo.ProcessingLogs)
|
||||
.Include(documentProcessingInfo => documentProcessingInfo.MemberNotificationInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class IncludeFiltersQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> IncludeFilters(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
return queryable.FilterDocType(filter)
|
||||
.FilterDocBusinessName(filter)
|
||||
.FilterByStatusType(filter)
|
||||
.FilterByCreatedDate(filter)
|
||||
.FilterByIndexFileJsonKeyValueEquals(filter)
|
||||
.FilterByIndexFileJsonKeyValueLikeOr(filter)
|
||||
.FilterIngestorRunInfoId(filter)
|
||||
.FilterByNotificationStatusType(filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Models.Pagination;
|
||||
using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Text;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions.Queryables
|
||||
{
|
||||
public static class SortableFieldsQueryable
|
||||
{
|
||||
public static IQueryable<DocumentProcessingInfo> OrderBySortableFields(this IQueryable<DocumentProcessingInfo> queryable, Filter filter)
|
||||
{
|
||||
if (filter?.SortableFields == null || !filter.SortableFields.Any())
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
var orderBy = new StringBuilder();
|
||||
foreach (var field in filter.SortableFields.OrderBy(sortableField => sortableField.Position))
|
||||
{
|
||||
var addedComma = orderBy.ToString() == "" ? "" : " ,";
|
||||
var desc = field.IsDescending ? " desc" : "";
|
||||
orderBy.Append($"{addedComma}{field.Field}{desc}");
|
||||
}
|
||||
|
||||
return queryable.OrderBy(orderBy.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using TimeZoneConverter;
|
||||
|
||||
namespace LCU.Api.Internal.DocumentIngestorLib.Extensions
|
||||
{
|
||||
public static class TimeZoneDateTime
|
||||
{
|
||||
public static DateTime ConvertToTimeZone(this DateTime dateTime, string timeZone)
|
||||
{
|
||||
var assumedTimezone = TZConvert.GetTimeZoneInfo(timeZone);
|
||||
return TimeZoneInfo.ConvertTime(dateTime, assumedTimezone);
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<Configurations>Debug;Release;Test</Configurations>
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.2" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
|
||||
<PackageReference Include="TimeZoneConverter" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LCU.Library.Internal.DocumentIngestorModels\LCU.Library.Internal.DocumentIngestorModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
|
||||
namespace LCU.API.Internal.DocumentIngestorLib.Persistence;
|
||||
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
public DbSet<IngestorRunInfo> IngestorRunInfos { get; set; }
|
||||
public DbSet<DocumentProcessingInfo> DocumentProcessingInfos { get; set; }
|
||||
public DbSet<ProcessingLog> ProcessingLogs { get; set; }
|
||||
public DbSet<DocumentTypeArchiveDeleteInfo> DocumentTypeArchiveDeleteInfos { get; set; }
|
||||
public DbSet<OwnerOverrideInfo> OwnerOverrideInfos { get; set; }
|
||||
public DbSet<PdfPartitionerRunInfo> PdfPartitionerRunInfos { get; set; }
|
||||
public DbSet<PdfPartitionerLog> PdfPartitionerLogs { get; set; }
|
||||
public DbSet<MemberNotificationInfo> MemberNotificationInfos { get; set; }
|
||||
public DbSet<OsgPreprocessorInfo> OsgPreprocessorInfos { get; set; }
|
||||
|
||||
[DbFunction(nameof(JSON_VALUE), IsBuiltIn = true)]
|
||||
public static string JSON_VALUE(string column, [NotParameterized] string path) => throw new InvalidOperationException();
|
||||
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
|
||||
builder.Entity<IngestorRunInfo>().ToTable("IngestorRunInfo");
|
||||
builder.Entity<DocumentProcessingInfo>().ToTable("DocumentProcessingInfo")
|
||||
.HasMany(x => x.MemberNotificationInfos)
|
||||
.WithOne()
|
||||
.HasForeignKey(x => x.DocumentProcessingInfoId)
|
||||
.IsRequired(false)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
builder.Entity<ProcessingLog>().ToTable("ProcessingLog");
|
||||
builder.Entity<DocumentTypeArchiveDeleteInfo>().ToTable("DocumentTypeArchiveDeleteInfo");
|
||||
builder.Entity<DocumentTypeArchiveDeleteInfo>().HasKey(d => d.DocumentTypeName);
|
||||
builder.Entity<OwnerOverrideInfo>().ToTable("OwnerOverrideInfo");
|
||||
builder.Entity<PdfPartitionerRunInfo>().ToTable("PdfPartitionerRunInfo");
|
||||
builder.Entity<PdfPartitionerLog>().ToTable("PdfPartitionerLog");
|
||||
builder.Entity<MemberNotificationInfo>().ToTable("MemberNotificationInfo");
|
||||
builder.Entity<OsgPreprocessorInfo>().ToTable("OsgPreprocessorInfo");
|
||||
}
|
||||
}
|
||||
+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