From 215b755f927f0ce7c15990a5cf66aa319171a101 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 9 Jun 2026 22:42:50 +0200 Subject: [PATCH] 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. --- .../Signatures/Commands/SignCommand.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Application/Signatures/Commands/SignCommand.cs b/EnvelopeGenerator.Application/Signatures/Commands/SignCommand.cs index f5660f9b..64f99a5f 100644 --- a/EnvelopeGenerator.Application/Signatures/Commands/SignCommand.cs +++ b/EnvelopeGenerator.Application/Signatures/Commands/SignCommand.cs @@ -1,18 +1,30 @@ using MediatR; using EnvelopeGenerator.Application.Common.Dto; using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver; +using EnvelopeGenerator.Application.Common.Query; namespace EnvelopeGenerator.Application.Signatures.Commands; /// /// Command to sign a document by a receiver. /// -public record SignCommand : IRequest +public record SignCommand : EnvelopeReceiverQueryBase, IRequest { + private EnvelopeReceiverDto? _envelopeReceiver; + + internal void SetEnvelopeReceiver(EnvelopeReceiverDto envelopeReceiver) + { + _envelopeReceiver = envelopeReceiver; + } + /// /// The envelope receiver information. /// - public required EnvelopeReceiverDto EnvelopeReceiver { get; init; } + public EnvelopeReceiverDto EnvelopeReceiver + { + get => _envelopeReceiver!; + init => _envelopeReceiver = value; + } /// /// The PSPDFKit annotation data. @@ -22,12 +34,13 @@ public record SignCommand : IRequest } /// -/// 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. /// public class SignCommandHandler : IRequestHandler { /// - /// Executes the signing command. Pipeline behaviors handle the actual processing. + /// Executes the signing command. Pipeline behaviors handle all processing. /// /// ///