Refactor SignCommand and improve handler comments
Refactored the `SignCommand` class to inherit from `EnvelopeReceiverQueryBase` and introduced a private backing field `_envelopeReceiver` for better encapsulation. Added an internal method `SetEnvelopeReceiver` to manage the envelope receiver data. Updated the `EnvelopeReceiver` property to use the backing field and removed the `required` modifier for more controlled initialization. Clarified comments in `SignCommandHandler` to emphasize that all processing is handled by pipeline behaviors, leaving the handler intentionally empty. Made minor adjustments to comments for improved clarity and consistency.
This commit is contained in:
@@ -1,18 +1,30 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
using EnvelopeGenerator.Application.Common.Dto;
|
using EnvelopeGenerator.Application.Common.Dto;
|
||||||
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
||||||
|
using EnvelopeGenerator.Application.Common.Query;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Signatures.Commands;
|
namespace EnvelopeGenerator.Application.Signatures.Commands;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Command to sign a document by a receiver.
|
/// Command to sign a document by a receiver.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public record SignCommand : IRequest
|
public record SignCommand : EnvelopeReceiverQueryBase, IRequest
|
||||||
{
|
{
|
||||||
|
private EnvelopeReceiverDto? _envelopeReceiver;
|
||||||
|
|
||||||
|
internal void SetEnvelopeReceiver(EnvelopeReceiverDto envelopeReceiver)
|
||||||
|
{
|
||||||
|
_envelopeReceiver = envelopeReceiver;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The envelope receiver information.
|
/// The envelope receiver information.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public required EnvelopeReceiverDto EnvelopeReceiver { get; init; }
|
public EnvelopeReceiverDto EnvelopeReceiver
|
||||||
|
{
|
||||||
|
get => _envelopeReceiver!;
|
||||||
|
init => _envelopeReceiver = value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The PSPDFKit annotation data.
|
/// The PSPDFKit annotation data.
|
||||||
@@ -22,12 +34,13 @@ public record SignCommand : IRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles the sign command. The actual work is done by SignCommandBehavior pipeline.
|
/// Handles the sign command. All work is done by pipeline behaviors.
|
||||||
|
/// This handler is intentionally empty - behaviors handle all the processing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SignCommandHandler : IRequestHandler<SignCommand>
|
public class SignCommandHandler : IRequestHandler<SignCommand>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes the signing command. Pipeline behaviors handle the actual processing.
|
/// Executes the signing command. Pipeline behaviors handle all processing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="request"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
|
|||||||
Reference in New Issue
Block a user