Add envelope history tracking and receiver signing status

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.
This commit is contained in:
2026-06-25 14:43:09 +02:00
parent de9c9da176
commit 85a0736106
2 changed files with 16 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using DigitalData.UserManager.Application.DTOs.User; using DigitalData.UserManager.Application.DTOs.User;
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver; using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
using EnvelopeGenerator.Application.Common.Dto.History;
using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using EnvelopeGenerator.Domain.Interfaces; using EnvelopeGenerator.Domain.Interfaces;
@@ -129,4 +130,9 @@ public record EnvelopeDto : IEnvelope
/// ///
/// </summary> /// </summary>
public IEnumerable<EnvelopeReceiverDto>? EnvelopeReceivers { get; set; } public IEnumerable<EnvelopeReceiverDto>? EnvelopeReceivers { get; set; }
/// <summary>
/// Envelope history entries tracking actions like DocumentSigned, EnvelopeOpened, etc.
/// </summary>
public IEnumerable<HistoryDto>? Histories { get; set; }
} }

View File

@@ -1,5 +1,6 @@
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using EnvelopeGenerator.Application.Common.Dto.Receiver; using EnvelopeGenerator.Application.Common.Dto.Receiver;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver; namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
@@ -73,4 +74,13 @@ public record EnvelopeReceiverDto
/// ///
/// </summary> /// </summary>
public bool HasPhoneNumber { get; init; } 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;
} }