Added a `Histories` property to `EnvelopeDto` to track envelope history entries for actions like `DocumentSigned` and `EnvelopeOpened`. Introduced a computed `Signed` property in `EnvelopeReceiverDto` to determine if a receiver has signed the envelope based on the history. Updated `using` directives to support these changes.
86 lines
1.9 KiB
C#
86 lines
1.9 KiB
C#
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
|
using EnvelopeGenerator.Application.Common.Dto.Receiver;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public record EnvelopeReceiverDto
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public EnvelopeDto? Envelope { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public ReceiverDto? Receiver { get; set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int EnvelopeId { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int ReceiverId { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int Sequence { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[TemplatePlaceholder("[NAME_RECEIVER]")]
|
|
public string? Name { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? JobTitle { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? CompanyName { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? PrivateMessage { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public DateTime AddedWhen { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public DateTime? ChangedWhen { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public bool HasPhoneNumber { get; init; }
|
|
|
|
/// <summary>
|
|
/// Indicates whether this receiver has signed the envelope.
|
|
/// Checks if there is a DocumentSigned history entry for this receiver in the envelope's history.
|
|
/// </summary>
|
|
public bool Signed => Envelope?.Histories?.Any(h =>
|
|
h.Receiver?.Id == ReceiverId &&
|
|
h.Status == EnvelopeStatus.DocumentSigned
|
|
) ?? false;
|
|
} |