Refaktorierung: Hauptentität auf EnvelopeReceiver geändert; Endlosschleifen-Bug behoben
- HomeController und ShowEnvelopeView aktualisiert. - Endlosschleifenproblem zwischen Envelope und EnvelopeReceiver gelöst. - Anpassungen an Envelope, EnvelopeDTO, EnvelopeRepository und EnvelopeService vorgenommen.
This commit is contained in:
@@ -12,7 +12,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool receivers = false, bool history = false, bool documentReceiverElement = false)
|
||||
public async Task<IEnumerable<Envelope>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false)
|
||||
{
|
||||
var query = _dbSet.AsQueryable();
|
||||
|
||||
@@ -22,31 +22,22 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
else
|
||||
query = query.Include(e => e.Documents);
|
||||
|
||||
if (receivers)
|
||||
query = query.Include(e => e.EnvelopeReceivers);
|
||||
|
||||
if (history)
|
||||
query = query.Include(e => e.History);
|
||||
|
||||
return await query.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, string? signature = null, bool withDocuments = false, bool withEnvelopeReceivers = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false)
|
||||
public async Task<Envelope?> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false)
|
||||
{
|
||||
var query = _dbSet.Where(e => e.Uuid == uuid);
|
||||
|
||||
if (signature is not null)
|
||||
query = query.Where(e => e.EnvelopeReceivers != null && e.EnvelopeReceivers.Any(er => er.Receiver != null && er.Receiver.Signature == signature));
|
||||
|
||||
if (withAll || withDocuments)
|
||||
if (withAll || withDocumentReceiverElement)
|
||||
query = query.Include(e => e.Documents!).ThenInclude(d => d.Elements);
|
||||
else
|
||||
query = query.Include(e => e.Documents);
|
||||
|
||||
if (withAll || withEnvelopeReceivers)
|
||||
query = query.Include(e => e.EnvelopeReceivers!).ThenInclude(er => er.Receiver);
|
||||
|
||||
if (withAll || withUser)
|
||||
query = query.Include(e => e.User!);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user