Refactor DocSignedNotification for better encapsulation

Refactored `DocSignedNotification` to remove inheritance from
`EnvelopeReceiverDto` and introduced a required `EnvelopeReceiver`
property. Updated all usages across the codebase to align with the
new structure, including controllers, handlers, and tests.

- Improved encapsulation and reduced coupling by making
  dependencies explicit.
- Updated `AnnotationController`, `DocStatusHandler`,
  `HistoryHandler`, and `SendSignedMailHandler` to use the
  `EnvelopeReceiver` property.
- Adjusted `DocSignedNotificationTests` to reflect the new
  instantiation pattern.
- Updated XML documentation and ensured consistent access to
  `EnvelopeReceiver` properties like `EnvelopeId`, `ReceiverId`,
  and `EmailAddress`.
This commit is contained in:
2026-06-09 16:34:49 +02:00
parent 49ac35153e
commit cd077aa1bd
7 changed files with 27 additions and 23 deletions

View File

@@ -16,25 +16,29 @@ namespace EnvelopeGenerator.Application.Common.Notifications.DocSigned;
public record PsPdfKitAnnotation(ExpandoObject Instant, IEnumerable<AnnotationCreateDto> Structured);
/// <summary>
///
/// Notification raised when a document is signed by a receiver.
/// </summary>
/// <param name="Original"></param>
public record DocSignedNotification(EnvelopeReceiverDto Original) : EnvelopeReceiverDto(Original), INotification, ISendMailNotification
public record DocSignedNotification : INotification, ISendMailNotification
{
/// <summary>
///
/// The envelope receiver information.
/// </summary>
public required EnvelopeReceiverDto EnvelopeReceiver { get; init; }
/// <summary>
/// The PSPDFKit annotation data.
/// </summary>
public PsPdfKitAnnotation? PsPdfKitAnnotation { get; init; }
/// <summary>
///
/// Gets the email template type.
/// </summary>
public EmailTemplateType TemplateType => EmailTemplateType.DocumentSigned;
/// <summary>
///
/// Gets the email address of the receiver.
/// </summary>
public string EmailAddress => Receiver?.EmailAddress
public string EmailAddress => EnvelopeReceiver.Receiver?.EmailAddress
?? throw new InvalidOperationException($"Receiver is null." +
$"DocSignedNotification:\n{this.ToJson(Format.Json.ForDiagnostics)}");
}