Add email template support and improve type safety

Updated documentation to include details on the `TBSIG_EMAIL_TEMPLATE` table, its structure, and runtime behavior. Enhanced code by introducing the `IDocument` interface and adding properties/methods to support email templates and document signing workflows. Replaced `int` with the `EnvelopeStatus` enum for improved type safety. Removed unused `Signed` property from `EnvelopeReceiverDto`. Added extension methods for `IDocument` and `IDocReceiverElement` to verify signing status. Updated deployment and troubleshooting guides to highlight email template requirements.
This commit is contained in:
2026-11-26 16:41:52 +01:00
parent 8cd4a1b888
commit 0dbbbaa207
9 changed files with 155 additions and 16 deletions

View File

@@ -1,9 +1,11 @@
using EnvelopeGenerator.Domain.Interfaces;
namespace EnvelopeGenerator.Application.Common.Dto;
/// <summary>
/// Data Transfer Object representing document metadata and elements without binary payload.
/// </summary>
public record DocumentDetailsDto
public record DocumentDetailsDto : IDocument
{
/// <summary>
/// Gets or sets the unique identifier of the document.
@@ -24,4 +26,9 @@ public record DocumentDetailsDto
/// Gets or sets the collection of elements associated with the document for receiver interactions, if any.
/// </summary>
public IEnumerable<DocReceiverElementDto>? Elements { get; init; }
/// <summary>
///
/// </summary>
public IEnumerable<IDocReceiverElement>? ElementsBase => Elements;
}

View File

@@ -79,13 +79,4 @@ public record EnvelopeReceiverDto
///
/// </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;
}

View File

@@ -1,4 +1,6 @@
namespace EnvelopeGenerator.Application.Common.Dto.History;
using EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Common.Dto.History;
/// <summary>
/// Data Transfer Object for creating a new envelope history record.
@@ -18,7 +20,7 @@ public class HistoryCreateDto
/// <summary>
/// Gets or sets the status of the envelope at the time of the action.
/// </summary>
public int Status { get; set; }
public EnvelopeStatus Status { get; set; }
/// <summary>
/// Gets or sets the date and time when the action occurred.

View File

@@ -144,7 +144,7 @@ public class EnvelopeHistoryService : CRUDService<IEnvelopeHistoryRepository, Hi
{
EnvelopeId = envelopeId,
UserReference = userReference,
Status = (int) status,
Status = status,
ActionDate = DateTime.Now,
Comment = comment
})