using DigitalData.Core.Abstraction.Application.Repository; using EnvelopeGenerator.Application.Common.Dto; using EnvelopeGenerator.Application.Signature.Commands; using EnvelopeGenerator.Domain.Entities; using MediatR; namespace EnvelopeGenerator.Application.Signature.Behaviors; /// /// Pipeline behavior that saves annotations. /// Executes first in the signing process. /// [Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")] public class AnnotationBehavior : IPipelineBehavior { private readonly IRepository _repo; /// /// /// /// public AnnotationBehavior(IRepository repository) { _repo = repository; } /// /// /// /// /// /// /// public async Task Handle(SignCommand request, RequestHandlerDelegate next, CancellationToken cancellationToken) { if (request.PsPdfKitAnnotation is PsPdfKitAnnotation annot) await _repo.CreateAsync(annot.Structured, cancellationToken); return await next(); } }