refactor(DocSignedNotification): Aktualisierung, um von EnvelopeReceiverDto zu erben.

- Erweiterungsmethoden für die Zuordnung hinzufügen.
This commit is contained in:
tekh 2025-09-03 15:38:41 +02:00
parent b599ada864
commit a433654f86

View File

@ -1,5 +1,4 @@
using EnvelopeGenerator.Application.Dto;
using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Application.Dto.EnvelopeReceiver;
using MediatR;
namespace EnvelopeGenerator.Application.Common.Notifications;
@ -7,10 +6,28 @@ namespace EnvelopeGenerator.Application.Common.Notifications;
/// <summary>
///
/// </summary>
public class DocSignedNotification : INotification
/// <param name="Original"></param>
public record DocSignedNotification(EnvelopeReceiverDto Original) : EnvelopeReceiverDto(Original)
{
}
/// <summary>
///
/// </summary>
public static class DocSignedNotificationExtensions
{
/// <summary>
///
/// Converts an <see cref="EnvelopeReceiverDto"/> to a <see cref="DocSignedNotification"/>.
/// </summary>
public required EnvelopeReceiver EnvelopeReceiver { get; init; }
/// <param name="dto">The DTO to convert.</param>
/// <returns>A new <see cref="DocSignedNotification"/> instance.</returns>
public static DocSignedNotification ToDocSignedNotification(this EnvelopeReceiverDto dto) => new (dto);
/// <summary>
/// Asynchronously converts a <see cref="Task{EnvelopeReceiverDto}"/> to a <see cref="DocSignedNotification"/>.
/// </summary>
/// <param name="dtoTask">The task that returns the DTO to convert.</param>
/// <returns>A task that represents the asynchronous conversion operation.</returns>
public static async Task<DocSignedNotification> ToDocSignedNotification(this Task<EnvelopeReceiverDto> dtoTask)
=> new(await dtoTask);
}