Referenztyp hinzugefügt, um zu klassifizieren, für wen Geschichte geschrieben wird.

This commit is contained in:
Developer 02
2024-06-04 13:50:17 +02:00
parent 65618e5df9
commit 34b3c46720
10 changed files with 66 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
{
}
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null, bool withReceiver = false)
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false)
{
var query = _dbSet.AsQueryable();
@@ -25,7 +25,10 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
if (status is not null)
query = query.Where(eh => eh.Status == status);
if(withReceiver)
if (withSender)
query = query.Include(eh => eh.Sender);
if (withReceiver)
query = query.Include(eh => eh.Receiver);
return query;
@@ -36,10 +39,12 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
userReference: userReference,
status: status).CountAsync();
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withReceiver = true) => await By(
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withSender = false, bool withReceiver = false)
=> await By(
envelopeId: envelopeId,
userReference: userReference,
status: status,
withSender: withSender,
withReceiver: withReceiver).ToListAsync();
}
}