From f8369e350f76a98c5e98e252dcd1eed38ae8ab7b Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 10 Nov 2025 13:01:33 +0100 Subject: [PATCH] refactor(BurnPdfCommand): replace manual JSON serialization with ToJson extension - Replaced `System.Text.Json.JsonSerializer.Serialize(request, Format.Json.ForDiagnostics)` with `request.ToJson(Format.Json.ForDiagnostics)` for better readability and consistency. - No functional changes, purely a code style and maintainability improvement. --- EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs index 09a2b40c..f51f59f2 100644 --- a/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs +++ b/EnvelopeGenerator.Application/Pdf/BurnPdfCommand.cs @@ -71,15 +71,15 @@ public class BurnPdfCommandHandler : IRequestHandler .Include(env => env.Documents!).ThenInclude(doc => doc.Elements!).ThenInclude(element => element.Annotations) .FirstOrDefaultAsync(cancel) ?? throw new BadRequestException($"Envelope could not be found. Request details:\n" + - System.Text.Json.JsonSerializer.Serialize(request, Format.Json.ForDiagnostics)); + request.ToJson(Format.Json.ForDiagnostics)); var doc = envelope.Documents?.FirstOrDefault() ?? throw new NotFoundException($"Document could not be located within the specified envelope. Request details:\n" + - System.Text.Json.JsonSerializer.Serialize(request, Format.Json.ForDiagnostics)); + request.ToJson(Format.Json.ForDiagnostics)); if (doc.ByteData is null) throw new InvalidOperationException($"Document byte data is missing, indicating a potential data integrity issue. Request details:\n" + - System.Text.Json.JsonSerializer.Serialize(request, Format.Json.ForDiagnostics)); + request.ToJson(Format.Json.ForDiagnostics)); return doc.Elements?.SelectMany(e => e.Annotations ?? Enumerable.Empty()).Where(annot => annot is not null).Any() ?? false ? BurnElementAnnotsToPDF(doc.ByteData, doc.Elements)