using DigitalData.Core.Abstraction.Application.Repository; using EnvelopeGenerator.Domain.Entities; using MediatR; namespace EnvelopeGenerator.Application.Common.Notifications.RemoveSignature.Handlers; /// /// /// public class RemoveAnnotationHandler : INotificationHandler { private readonly IRepository _repo; /// /// /// /// public RemoveAnnotationHandler(IRepository repository) { _repo = repository; } /// /// /// /// /// /// public Task Handle(RemoveSignatureNotification notification, CancellationToken cancel) { return _repo.DeleteAsync(annots => { annots = annots.Where(annot => annot.Element!.Document.Envelope!.Uuid == notification.EnvelopeUuid); if (notification.ReceiverSignature is string signature) annots = annots.Where(annot => annot.Element!.Receiver!.Signature == signature); return annots; }, cancel); } }