feat(RemoveHistoryHandler): add filtering by receiver signature in RemoveHistoryHandler

Added logic to filter history records by receiver signature when provided in
RemoveSignatureNotification. This ensures only relevant signed entries are deleted.
This commit is contained in:
tekh 2025-10-21 15:51:55 +02:00
parent b57c0aa9c7
commit 40135fb8a2

View File

@ -27,12 +27,18 @@ public class RemoveHistoryHandler : INotificationHandler<RemoveSignatureNotifica
/// <param name="notification"></param>
/// <param name="cancel"></param>
/// <returns></returns>
public async Task Handle(RemoveSignatureNotification notification, CancellationToken cancel)
public Task Handle(RemoveSignatureNotification notification, CancellationToken cancel)
{
await _repo.DeleteAsync(hists
=> hists
return _repo.DeleteAsync(hists =>
{
hists = hists
.Where(hist => hist.Envelope!.Uuid == notification.EnvelopeUuid)
.Where(hist => hist.Status == EnvelopeStatus.DocumentSigned),
cancel);
.Where(hist => hist.Status == EnvelopeStatus.DocumentSigned);
if (notification.ReceiverSignature is string signature)
hists = hists.Where(hist => hist.Receiver!.Signature == signature);
return hists;
}, cancel);
}
}