feat: Begrüßung und Dokumentdetails auf Umschlagseite aktualisiert

This commit is contained in:
Developer 02
2024-04-08 16:39:02 +02:00
parent 2512de0f26
commit 1584fd6f1c
6 changed files with 16 additions and 14 deletions

View File

@@ -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();