- Implements INotificationHandler<RemoveSignatureNotification> - Deletes Annotation entities matching the Envelope UUID from the repository - Uses IRepository<Annotation> for data access
33 lines
957 B
C#
33 lines
957 B
C#
using DigitalData.Core.Abstraction.Application.Repository;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
using MediatR;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Notifications.RemoveSignature.Handlers;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class RemoveAnnotationHandler : INotificationHandler<RemoveSignatureNotification>
|
|
{
|
|
private readonly IRepository<Annotation> _repo;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="repository"></param>
|
|
public RemoveAnnotationHandler(IRepository<Annotation> repository)
|
|
{
|
|
_repo = repository;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="notification"></param>
|
|
/// <param name="cancel"></param>
|
|
/// <returns></returns>
|
|
public Task Handle(RemoveSignatureNotification notification, CancellationToken cancel)
|
|
{
|
|
return _repo.DeleteAsync(a => a.Element!.Document.Envelope!.Uuid == notification.EnvelopeUuid, cancel);
|
|
}
|
|
} |