Adding
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch
|
||||
{
|
||||
public interface IRepoSyncBatchRepository: ICrudRepository<RepoSyncBatch>
|
||||
{
|
||||
Task<IEnumerable<RepoSyncBatch>> FindAllByRunInfoIdAsync(int id);
|
||||
Task<RepoSyncBatch> FindUncompletedByAuditId(string auditItemKey);
|
||||
Task<RepoSyncBatch> FindByBatchIdAndAuditIdAsync(int batchId, string auditItemKey);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch
|
||||
{
|
||||
public interface IRepoSyncRunInfoRepository: ICrudRepository<RepoSyncRunInfo>
|
||||
{
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch;
|
||||
|
||||
public class RepoSyncBatchRepository : CrudRepository<RepoSyncBatch>, IRepoSyncBatchRepository
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public RepoSyncBatchRepository(AppDbContext context) : base(context) {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoSyncBatch>> FindAllByRunInfoIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoSyncBatch.Where(repoSyncBatch => repoSyncBatch.RepoSyncRunInfoId == id).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoSyncBatch> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoSyncBatch.Where(repoSyncBatch => repoSyncBatch.RepoSyncBatchId == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoSyncBatch> FindUncompletedByAuditId(string auditItemKey) =>
|
||||
await _context.RepoSyncBatch
|
||||
.Where(repoSyncBatch => repoSyncBatch.AuditItemKey == auditItemKey && repoSyncBatch.RepoSyncCompletionDateTime == null)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
public async Task<RepoSyncBatch> FindByBatchIdAndAuditIdAsync(int batchId, string auditItemKey) =>
|
||||
await _context.RepoSyncBatch
|
||||
.Where(repoSyncBatch => repoSyncBatch.RepoSyncBatchId == batchId && repoSyncBatch.AuditItemKey == auditItemKey)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch;
|
||||
|
||||
public class RepoSyncRunInfoRepository : CrudRepository<RepoSyncRunInfo>, IRepoSyncRunInfoRepository
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public RepoSyncRunInfoRepository(AppDbContext context) : base(context) {
|
||||
_context = context;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user