refactor(RemoveSignatureNotification): Alle Filter von Handlern an die Bedingung binden, dass sie nicht null sind.

This commit is contained in:
2025-10-22 10:38:08 +02:00
parent 2004c7ced2
commit 1edcfed318
3 changed files with 46 additions and 12 deletions

View File

@@ -31,12 +31,23 @@ public class RemoveHistoryHandler : INotificationHandler<RemoveSignatureNotifica
{
return _repo.DeleteAsync(hists =>
{
hists = hists
.Where(hist => hist.Envelope!.Uuid == notification.EnvelopeUuid)
.Where(hist => hist.Status == EnvelopeStatus.DocumentSigned);
hists = hists.Where(hist => hist.Status == EnvelopeStatus.DocumentSigned);
if (notification.ReceiverSignature is string signature)
hists = hists.Where(hist => hist.Receiver!.Signature == signature);
// envelope ID filter
if (notification.EnvelopeId is int envelopeId)
hists = hists.Where(hist => hist.EnvelopeId == envelopeId);
// envelope UUID filter
if (notification.EnvelopeUuid is string envelopeUuid)
hists = hists.Where(hist => hist.Envelope!.Uuid == envelopeUuid);
// receiver ID filter
if (notification.ReceiverId is int receiverId)
hists = hists.Where(hist => hist.Receiver!.Id == receiverId);
// receiver signature filter
if (notification.ReceiverSignature is string receiverSignature)
hists = hists.Where(hist => hist.Receiver!.Signature == receiverSignature);
return hists;
}, cancel);