diff --git a/EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs b/EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs index 601ac1b0..822a57fe 100644 --- a/EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs +++ b/EnvelopeGenerator.Application/Common/Dto/EnvelopeDto.cs @@ -1,6 +1,7 @@ using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using DigitalData.UserManager.Application.DTOs.User; using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver; +using EnvelopeGenerator.Application.Common.Dto.History; using EnvelopeGenerator.Domain.Constants; using EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Interfaces; @@ -129,4 +130,9 @@ public record EnvelopeDto : IEnvelope /// /// public IEnumerable? EnvelopeReceivers { get; set; } + + /// + /// Envelope history entries tracking actions like DocumentSigned, EnvelopeOpened, etc. + /// + public IEnumerable? Histories { get; set; } } \ No newline at end of file diff --git a/EnvelopeGenerator.Application/Common/Dto/EnvelopeReceiver/EnvelopeReceiverDto.cs b/EnvelopeGenerator.Application/Common/Dto/EnvelopeReceiver/EnvelopeReceiverDto.cs index 34a74c2b..b75722d9 100644 --- a/EnvelopeGenerator.Application/Common/Dto/EnvelopeReceiver/EnvelopeReceiverDto.cs +++ b/EnvelopeGenerator.Application/Common/Dto/EnvelopeReceiver/EnvelopeReceiverDto.cs @@ -1,5 +1,6 @@ using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes; using EnvelopeGenerator.Application.Common.Dto.Receiver; +using EnvelopeGenerator.Domain.Constants; namespace EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver; @@ -73,4 +74,13 @@ public record EnvelopeReceiverDto /// /// public bool HasPhoneNumber { get; init; } + + /// + /// Indicates whether this receiver has signed the envelope. + /// Checks if there is a DocumentSigned history entry for this receiver in the envelope's history. + /// + public bool Signed => Envelope?.Histories?.Any(h => + h.Receiver?.Id == ReceiverId && + h.Status == EnvelopeStatus.DocumentSigned + ) ?? false; } \ No newline at end of file