refactor(AddReportBehavior): update to add history record.
This commit is contained in:
parent
67d0980c63
commit
35b7b1a080
@ -34,7 +34,7 @@ public record CreateHistoryCommand : EnvelopeReceiverQueryBase, IRequest<History
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
public DateTime AddedWhen { get; } = DateTime.UtcNow;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using MediatR;
|
using MediatR;
|
||||||
|
using EnvelopeGenerator.Application.Histories.Commands;
|
||||||
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Application.Pdf.Behaviors;
|
namespace EnvelopeGenerator.Application.Pdf.Behaviors;
|
||||||
|
|
||||||
@ -7,6 +9,17 @@ namespace EnvelopeGenerator.Application.Pdf.Behaviors;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
||||||
{
|
{
|
||||||
|
private readonly ISender _sender;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
public AddReportBehavior(ISender sender)
|
||||||
|
{
|
||||||
|
_sender = sender;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -18,6 +31,14 @@ public class AddReportBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
|
|||||||
{
|
{
|
||||||
var docResult = await next(cancel);
|
var docResult = await next(cancel);
|
||||||
var base64 = Convert.ToBase64String(docResult);
|
var base64 = Convert.ToBase64String(docResult);
|
||||||
|
|
||||||
|
await _sender.Send(new CreateHistoryCommand()
|
||||||
|
{
|
||||||
|
EnvelopeId = request.EnvelopeId,
|
||||||
|
UserReference = "System",
|
||||||
|
Status = EnvelopeStatus.EnvelopeReportCreated,
|
||||||
|
}, cancel);
|
||||||
|
|
||||||
return docResult;
|
return docResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user