Add support for signing PDFs with DocReceiverElement
Extended `DocReceiverElementDto` to include an optional `Document` reference. Enhanced `ReadDocReceiverElementQuery` with `Id` and `IncludeDocument` properties for filtering and document inclusion. Updated `ReadDocReceiverElementQueryHandler` to handle new query properties, enabling filtering by `Id` and optionally including associated documents. Introduced `SignPdfByElementCommand` and its handler to support signing PDFs using either a provided `DocReceiverElementDto` or an `ElementId`. Added validation via `SignPdfByElementCommandValidator` to ensure proper usage. Refactored and added necessary `using` directives for new dependencies.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using FluentValidation;
|
||||
|
||||
namespace EnvelopeGenerator.Application.PdfSigning;
|
||||
|
||||
public class SignPdfByElementCommandValidator : AbstractValidator<SignPdfByElementCommand>
|
||||
{
|
||||
public SignPdfByElementCommandValidator()
|
||||
{
|
||||
RuleFor(x => x)
|
||||
.Must(x => (x.Element is not null) ^ x.ElementId.HasValue)
|
||||
.WithMessage("Exactly one of Element or ElementId must be provided.");
|
||||
|
||||
RuleFor(x => x.ElementId)
|
||||
.GreaterThan(0)
|
||||
.When(x => x.ElementId.HasValue)
|
||||
.WithMessage("ElementId must be greater than 0.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user