Feature-Update: Erweiterung der Envelope- und DocumentReceiverElement-Abfragen
Die Methoden `ReadAllWithAsync` und `ReadByUuidAsync` in `EnvelopeRepository` wurden erweitert, um optional DocumentReceiverElemente und Signaturdetails einzubeziehen.
This commit is contained in:
@@ -12,12 +12,15 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false)
|
||||
public async Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false, bool documentReceiverElement = false)
|
||||
{
|
||||
var query = _dbSet.AsQueryable();
|
||||
|
||||
if (documents)
|
||||
query = query.Include(e => e.Documents);
|
||||
if (documentReceiverElement)
|
||||
query = query.Include(e => e.Documents!).ThenInclude(d => d.Elements);
|
||||
else
|
||||
query = query.Include(e => e.Documents);
|
||||
|
||||
if (receivers)
|
||||
query = query.Include(e => e.Receivers);
|
||||
@@ -28,12 +31,15 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withReceivers = false, bool withHistory = false)
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false)
|
||||
{
|
||||
var query = _dbSet.Where(e => e.Uuid == uuid);
|
||||
|
||||
if (withDocuments)
|
||||
query = query.Include(e => e.Documents);
|
||||
if (withDocumentReceiverElement)
|
||||
query = query.Include(e => e.Documents!).ThenInclude(d => d.Elements);
|
||||
else
|
||||
query = query.Include(e => e.Documents);
|
||||
|
||||
if (withReceivers)
|
||||
query = query.Include(e => e.Receivers);
|
||||
|
||||
Reference in New Issue
Block a user