refactor(BurnPdfCommand): add extension methods for ISender
- Introduce BurnPdfCommandExtensions to simplify sending BurnPdfCommand via ISender - Enables calling `sender.BurnPdf(envelopeId, cancel)` or `sender.BurnPdf(envelopeUuid, cancel)` - No changes to the underlying PDF burning logic in BurnPdfCommandHandler
This commit is contained in:
parent
495adb8c31
commit
8aea3c8301
@ -20,6 +20,32 @@ namespace EnvelopeGenerator.Application.Pdf;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public record BurnPdfCommand(int? EnvelopeId = null, string? EnvelopeUuid = null) : IRequest<byte[]>;
|
public record BurnPdfCommand(int? EnvelopeId = null, string? EnvelopeUuid = null) : IRequest<byte[]>;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class BurnPdfCommandExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="envelopeId"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task<byte[]> BurnPdf(this ISender sender, int envelopeId, CancellationToken cancel)
|
||||||
|
=> sender.Send(new BurnPdfCommand(EnvelopeId: envelopeId), cancel);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="envelopeUuid"></param>
|
||||||
|
/// <param name="cancel"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Task<byte[]> BurnPdf(this ISender sender, string envelopeUuid, CancellationToken cancel)
|
||||||
|
=> sender.Send(new BurnPdfCommand(EnvelopeUuid: envelopeUuid), cancel);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -11,14 +11,11 @@ namespace EnvelopeGenerator.Finalizer.Job
|
|||||||
{
|
{
|
||||||
private readonly ILogger<FinishEnvelopeJob> _logger;
|
private readonly ILogger<FinishEnvelopeJob> _logger;
|
||||||
|
|
||||||
private readonly GdPictureOptions _gdPictureOptions;
|
|
||||||
|
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
|
|
||||||
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger, IOptions<GdPictureOptions> gdPictureOptions, IMediator mediator)
|
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger, IMediator mediator)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_gdPictureOptions = gdPictureOptions.Value;
|
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +25,7 @@ namespace EnvelopeGenerator.Finalizer.Job
|
|||||||
|
|
||||||
var envelopes = await _mediator.Send(new ReadEnvelopeQuery()
|
var envelopes = await _mediator.Send(new ReadEnvelopeQuery()
|
||||||
{
|
{
|
||||||
Status = new() { Include = [EnvelopeStatus.EnvelopeCompletelySigned] },
|
Status = new() { Include = [ EnvelopeStatus.EnvelopeCompletelySigned ] },
|
||||||
HasDocResult = false
|
HasDocResult = false
|
||||||
}, cancel);
|
}, cancel);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user