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
This commit is contained in:
tekh 2025-11-10 09:30:04 +01:00
parent 36b03da084
commit ffffc2d470

View File

@ -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;
/// <summary>
///
/// </summary>
public record BurnPdfCommand(byte[] Document, List<string> InstantJSONList, int EnvelopeId) : IRequest<byte[]>;
public record BurnPdfCommand : IRequest<byte[]?>
{
/// <summary>
///
/// </summary>
public EnvelopeQueryBase? Envelope { get; set; }
/// <summary>
///
/// </summary>
public byte[]? Document { get; set; }
/// <summary>
///
/// </summary>
public List<string>? InstantJSONList { get; set; }
/// <summary>
///
/// </summary>
public bool ByCronService { get; set; } = true;
}
/// <summary>
///
@ -59,7 +81,7 @@ public class BurnPdfCommandHandler : IRequestHandler<BurnPdfCommand, byte[]>
{
// 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);