feat: Begrüßung und Dokumentdetails auf Umschlagseite aktualisiert
This commit is contained in:
@@ -31,23 +31,23 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false)
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withAll = false)
|
||||
{
|
||||
var query = _dbSet.Where(e => e.Uuid == uuid);
|
||||
|
||||
if (signature is not null)
|
||||
query = query.Where(e => e.Receivers != null && e.Receivers.Any(er => er.Receiver != null && er.Receiver.Signature == signature));
|
||||
|
||||
if (withDocuments)
|
||||
if (withAll || withDocuments)
|
||||
if (withDocumentReceiverElement)
|
||||
query = query.Include(e => e.Documents!).ThenInclude(d => d.Elements);
|
||||
else
|
||||
query = query.Include(e => e.Documents);
|
||||
|
||||
if (withReceivers)
|
||||
if (withAll || withReceivers)
|
||||
query = query.Include(e => e.Receivers!).ThenInclude(er => er.Receiver);
|
||||
|
||||
if (withHistory)
|
||||
if (withAll || withHistory)
|
||||
query = query.Include(e => e.History);
|
||||
|
||||
return await query.FirstOrDefaultAsync();
|
||||
|
||||
Reference in New Issue
Block a user