From a35e05d01650c8eb534146108faa8514f580fcac Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 28 Oct 2026 16:28:17 +0100 Subject: [PATCH] Refactor Attachments property and syntax Changed the `Attachments` property type in `EnvelopeNotificationBase.cs` from `List` to `IReadOnlyList` to enhance immutability and thread safety. Updated the `FinalizeEnvelopeCommandHandler` in `FinalizeEnvelopeCommand.cs` to use a single-line syntax for `Attachments` initialization, improving code readability. --- .../Services/Notification/EnvelopeNotificationBase.cs | 2 +- .../PdfSigning/FinalizeEnvelopeCommand.cs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/EnvelopeNotificationBase.cs b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/EnvelopeNotificationBase.cs index 1d22fd01..f43df0cc 100644 --- a/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/EnvelopeNotificationBase.cs +++ b/EnvelopeGenerator.Application/Common/Interfaces/Services/Notification/EnvelopeNotificationBase.cs @@ -15,5 +15,5 @@ public abstract record EnvelopeNotificationBase /// /// /// - public List<(string FileName, byte[] Content)>? Attachments { get; init; } + public IReadOnlyList<(string FileName, byte[] Content)>? Attachments { get; init; } } diff --git a/EnvelopeGenerator.Application/PdfSigning/FinalizeEnvelopeCommand.cs b/EnvelopeGenerator.Application/PdfSigning/FinalizeEnvelopeCommand.cs index 2a7aff81..737320a8 100644 --- a/EnvelopeGenerator.Application/PdfSigning/FinalizeEnvelopeCommand.cs +++ b/EnvelopeGenerator.Application/PdfSigning/FinalizeEnvelopeCommand.cs @@ -98,9 +98,7 @@ public class FinalizeEnvelopeCommandHandler(IRepository Repo, ISender { DocumentTitle = envelope.Title, NameReceiver = er.Name, - Attachments = [ - ($"unterzeichnetes-dokument.pdf", doc) - ] + Attachments = [($"unterzeichnetes-dokument.pdf", doc)] }, cancel); }