From ffffc2d470603caccae858a0d8a00b09dc88b79f Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 10 Nov 2025 09:30:04 +0100 Subject: [PATCH] refactor(BurnPdfCommand): update BurnPdfCommand to use EnvelopeQueryBase and enhance request structure - Replaced record-based BurnPdfCommand with class-based implementation - Added Envelope property of type EnvelopeQueryBase - Changed parameters to nullable (Document, InstantJSONList) - Added ByCronService flag for cron-based PDF burning control - Updated query logic to use request.Envelope.Id instead of EnvelopeId - Improved code structure for flexibility and service integration --- .../Pdf/BurnPdfCommand.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index 2b5dc2dd..08fea4bf 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -11,13 +11,35 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Newtonsoft.Json; using EnvelopeGenerator.Application.Common.Extensions; +using EnvelopeGenerator.Application.Common.Query; namespace EnvelopeGenerator.Application.Pdf; /// /// /// -public record BurnPdfCommand(byte[] Document, List InstantJSONList, int EnvelopeId) : IRequest; +public record BurnPdfCommand : IRequest +{ + /// + /// + /// + public EnvelopeQueryBase? Envelope { get; set; } + + /// + /// + /// + public byte[]? Document { get; set; } + + /// + /// + /// + public List? InstantJSONList { get; set; } + + /// + /// + /// + public bool ByCronService { get; set; } = true; +} /// /// @@ -59,7 +81,7 @@ public class BurnPdfCommandHandler : IRequestHandler { // read the elements of envelope with their annotations var elements = await _signRepo - .Where(sig => sig.Document.EnvelopeId == request.EnvelopeId) + .Where(sig => sig.Document.EnvelopeId == request.Envelope.Id) .Include(sig => sig.Annotations) .ToListAsync(cancel);