feat(pdf): add annotation burning logic and repository dependency to BurnPdfCommandHandler
- Inject IRepository<Signature> 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
This commit is contained in:
parent
b2ace61cd4
commit
fcfed963b7
@ -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 GdPicture14;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Pdf;
|
namespace EnvelopeGenerator.Application.Pdf;
|
||||||
|
|
||||||
@ -23,15 +27,54 @@ public class BurnPdfCommandHandler : IRequestHandler<BurnPdfCommand>
|
|||||||
|
|
||||||
private readonly AnnotationManager _manager;
|
private readonly AnnotationManager _manager;
|
||||||
|
|
||||||
|
private readonly IRepository<Signature> _signRepo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pdfBurnerParams"></param>
|
/// <param name="pdfBurnerParams"></param>
|
||||||
/// <param name="manager"></param>
|
/// <param name="manager"></param>
|
||||||
public BurnPdfCommandHandler(PDFBurnerParams pdfBurnerParams, AnnotationManager manager)
|
/// <param name="signRepo"></param>
|
||||||
|
public BurnPdfCommandHandler(PDFBurnerParams pdfBurnerParams, AnnotationManager manager, IRepository<Signature> signRepo)
|
||||||
{
|
{
|
||||||
_pdfBurnerParams = pdfBurnerParams;
|
_pdfBurnerParams = pdfBurnerParams;
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
|
_signRepo = signRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] BurnAnnotsToPDF(byte[] pSourceBuffer, List<string> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pSourceBuffer"></param>
|
||||||
|
/// <param name="elements"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public byte[] BurnElementAnnotsToPDF(byte[] pSourceBuffer, List<Signature> elements)
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<byte>().ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pSourceBuffer"></param>
|
||||||
|
/// <param name="pInstantJSONList"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public byte[] BurnInstantJSONAnnotsToPDF(byte[] pSourceBuffer, List<string> pInstantJSONList)
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<byte>().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user