add SaveBurnedPdfBehavior to services

This commit is contained in:
2025-11-10 15:29:16 +01:00
parent a2df5d7691
commit 31f5d1f340
3 changed files with 4 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
using EnvelopeGenerator.Application.Pdf;
using MediatR;
using Org.BouncyCastle.Utilities;
namespace EnvelopeGenerator.Application.Common.Behaviors;
@@ -15,10 +16,10 @@ public class SaveBurnedPdfBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
/// <param name="next"></param>
/// <param name="cancel"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<byte[]> Handle(BurnPdfCommand request, RequestHandlerDelegate<byte[]> next, CancellationToken cancel)
{
var docResult = await next(cancel);
var base64 = Convert.ToBase64String(docResult);
return docResult;
}
}

View File

@@ -11,6 +11,7 @@ using Microsoft.Extensions.Options;
using QRCoder;
using System.Reflection;
using GdPicture14;
using EnvelopeGenerator.Application.Common.Behaviors;
namespace EnvelopeGenerator.Application;
@@ -86,6 +87,7 @@ public static class DependencyInjection
services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
cfg.AddBehavior<SaveBurnedPdfBehavior>();
});
// Add memory cache