Replaced the `SignatureDto` record with a new `Signature` record to provide a more robust representation of signature data. Updated `MappingProfile` to map `Signature` to `DocReceiverElement` and removed the old `SignatureDto` mapping. Updated `SigningCommand` to use `IEnumerable<Signature>` instead of `IEnumerable<SignatureDto>`. Removed the old `MappingProfile` class and adjusted namespaces and `using` directives accordingly. These changes improve maintainability and streamline signature handling.
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using MediatR;
|
|
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
|
using EnvelopeGenerator.Application.Common.Query;
|
|
|
|
namespace EnvelopeGenerator.Application.DocReceiverElements.Commands;
|
|
|
|
/// <summary>
|
|
/// Command to sign a document by a receiver.
|
|
/// </summary>
|
|
public record SigningCommand : EnvelopeReceiverQueryBase, IRequest
|
|
{
|
|
private EnvelopeReceiverDto? _envelopeReceiver;
|
|
|
|
internal void SetEnvelopeReceiver(EnvelopeReceiverDto envelopeReceiver)
|
|
{
|
|
_envelopeReceiver = envelopeReceiver;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The envelope receiver information.
|
|
/// </summary>
|
|
public EnvelopeReceiverDto EnvelopeReceiver
|
|
{
|
|
get => _envelopeReceiver!;
|
|
init => _envelopeReceiver = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// The PSPDFKit annotation data.
|
|
/// </summary>
|
|
[Obsolete("This notification is deprecated. Use Signature.Commands.SignCommand instead.")]
|
|
public PsPdfKitAnnotation? PsPdfKitAnnotation { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public IEnumerable<Signature>? Signatures { get; init; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Handles the sign command. All work is done by pipeline behaviors.
|
|
/// This handler is intentionally empty - behaviors handle all the processing.
|
|
/// </summary>
|
|
public class SignCommandHandler : IRequestHandler<SigningCommand>
|
|
{
|
|
/// <summary>
|
|
/// Executes the signing command. Pipeline behaviors handle all processing.
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <param name="cancellationToken"></param>
|
|
/// <returns></returns>
|
|
public Task Handle(SigningCommand request, CancellationToken cancellationToken = default)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
} |