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>
|
||||
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>
|
||||
|
||||
@ -11,14 +11,11 @@ namespace EnvelopeGenerator.Finalizer.Job
|
||||
{
|
||||
private readonly ILogger<FinishEnvelopeJob> _logger;
|
||||
|
||||
private readonly GdPictureOptions _gdPictureOptions;
|
||||
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger, IOptions<GdPictureOptions> gdPictureOptions, IMediator mediator)
|
||||
public FinishEnvelopeJob(ILogger<FinishEnvelopeJob> logger, IMediator mediator)
|
||||
{
|
||||
_logger = logger;
|
||||
_gdPictureOptions = gdPictureOptions.Value;
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user