Refactor status parameter to use EnvelopeStatus type
Updated IEnvelopeHistoryRepository and IEnvelopeHistoryService interfaces to replace int? status with Constants.EnvelopeStatus? status in CountAsync and ReadAsync methods. Adjusted ReadHistoryQueryHandler and EnvelopeHistoryService methods to accommodate the new type. Modified EnvelopeHistoryRepository to accept Constants.EnvelopeStatus? in relevant methods and marked it as obsolete, suggesting a future refactor.
This commit is contained in:
@@ -2,16 +2,18 @@
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using EnvelopeGenerator.Domain;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use Repository")]
|
||||
public class EnvelopeHistoryRepository : CRUDRepository<EnvelopeHistory, long, EGDbContext>, IEnvelopeHistoryRepository
|
||||
{
|
||||
public EnvelopeHistoryRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeHistories)
|
||||
{
|
||||
}
|
||||
|
||||
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false)
|
||||
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, Constants.EnvelopeStatus? status = null, bool withSender = false, bool withReceiver = false)
|
||||
{
|
||||
var query = _dbSet.AsNoTracking();
|
||||
|
||||
@@ -33,12 +35,12 @@ public class EnvelopeHistoryRepository : CRUDRepository<EnvelopeHistory, long, E
|
||||
return query;
|
||||
}
|
||||
|
||||
public async Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null) => await By(
|
||||
public async Task<int> CountAsync(int? envelopeId = null, string? userReference = null, Constants.EnvelopeStatus? status = null) => await By(
|
||||
envelopeId: envelopeId,
|
||||
userReference: userReference,
|
||||
status: status).CountAsync();
|
||||
|
||||
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false)
|
||||
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, Constants.EnvelopeStatus? status = null, bool withSender = false, bool withReceiver = false)
|
||||
=> await By(
|
||||
envelopeId: envelopeId,
|
||||
userReference: userReference,
|
||||
|
||||
Reference in New Issue
Block a user