From fcfed963b7cff8c9767df5f452c9222134386a38 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 6 Nov 2025 21:30:51 +0100 Subject: [PATCH] feat(pdf): add annotation burning logic and repository dependency to BurnPdfCommandHandler - Inject IRepository for accessing signature and annotation data - Implement BurnAnnotsToPDF method to process annotations from DB or JSON - Add BurnElementAnnotsToPDF and BurnInstantJSONAnnotsToPDF stubs - Integrate EF Core Include for loading related entities --- .../Pdf/BurnPdfCommand.cs | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index ca562fd2..97e1d783 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -1,6 +1,10 @@ -using EnvelopeGenerator.Application.Common.Configurations; +using DigitalData.Core.Abstraction.Application.Repository; +using DigitalData.Core.Abstractions; +using EnvelopeGenerator.Application.Common.Configurations; +using EnvelopeGenerator.Domain.Entities; using GdPicture14; using MediatR; +using Microsoft.EntityFrameworkCore; namespace EnvelopeGenerator.Application.Pdf; @@ -23,15 +27,54 @@ public class BurnPdfCommandHandler : IRequestHandler private readonly AnnotationManager _manager; + private readonly IRepository _signRepo; + /// /// /// /// /// - public BurnPdfCommandHandler(PDFBurnerParams pdfBurnerParams, AnnotationManager manager) + /// + public BurnPdfCommandHandler(PDFBurnerParams pdfBurnerParams, AnnotationManager manager, IRepository signRepo) { _pdfBurnerParams = pdfBurnerParams; _manager = manager; + _signRepo = signRepo; + } + + public byte[] BurnAnnotsToPDF(byte[] pSourceBuffer, List pInstantJSONList, int envelopeId) + { + // read the elements of envelope with their annotations + var elements = _signRepo + .Where(sig => sig.Document.EnvelopeId == envelopeId) + .Include(sig => sig.Annotations) + .ToList(); + + return elements.Any() + ? BurnElementAnnotsToPDF(pSourceBuffer, elements) + : BurnInstantJSONAnnotsToPDF(pSourceBuffer, pInstantJSONList); + } + + /// + /// + /// + /// + /// + /// + public byte[] BurnElementAnnotsToPDF(byte[] pSourceBuffer, List elements) + { + return Enumerable.Empty().ToArray(); + } + + /// + /// + /// + /// + /// + /// + public byte[] BurnInstantJSONAnnotsToPDF(byte[] pSourceBuffer, List pInstantJSONList) + { + return Enumerable.Empty().ToArray(); } ///