From defa53fa2645475899f644dee4b6168c2bac559b Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 7 Nov 2025 14:56:34 +0100 Subject: [PATCH] refactor(BurnPdfCommand): rename SourceBuffer to Document in BurnPdfCommand and handler - Renamed parameter `SourceBuffer` to `Document` in BurnPdfCommand record - Updated all usages of `request.SourceBuffer` to `request.Document` - Reorganized method order for better readability (Handle moved up) - No functional or behavioral changes introduced --- .../Pdf/BurnPdfCommand.cs | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index 53a269d3..2b5dc2dd 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -17,7 +17,7 @@ namespace EnvelopeGenerator.Application.Pdf; /// /// /// -public record BurnPdfCommand(byte[] SourceBuffer, List InstantJSONList, int EnvelopeId) : IRequest; +public record BurnPdfCommand(byte[] Document, List InstantJSONList, int EnvelopeId) : IRequest; /// /// @@ -47,6 +47,27 @@ public class BurnPdfCommandHandler : IRequestHandler _logger = logger; } + + /// + /// + /// + /// + /// + /// + /// + public async Task Handle(BurnPdfCommand request, CancellationToken cancel) + { + // read the elements of envelope with their annotations + var elements = await _signRepo + .Where(sig => sig.Document.EnvelopeId == request.EnvelopeId) + .Include(sig => sig.Annotations) + .ToListAsync(cancel); + + return elements.Count > 0 + ? BurnElementAnnotsToPDF(request.Document, elements) + : BurnInstantJSONAnnotsToPDF(request.Document, request.InstantJSONList); + } + private byte[] BurnElementAnnotsToPDF(byte[] pSourceBuffer, List elements) { // Add background @@ -217,24 +238,4 @@ public class BurnPdfCommandHandler : IRequestHandler } } } - - /// - /// - /// - /// - /// - /// - /// - public async Task Handle(BurnPdfCommand request, CancellationToken cancel) - { - // read the elements of envelope with their annotations - var elements = await _signRepo - .Where(sig => sig.Document.EnvelopeId == request.EnvelopeId) - .Include(sig => sig.Annotations) - .ToListAsync(cancel); - - return elements.Count > 0 - ? BurnElementAnnotsToPDF(request.SourceBuffer, elements) - : BurnInstantJSONAnnotsToPDF(request.SourceBuffer, request.InstantJSONList); - } } \ No newline at end of file