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

@@ -13,7 +13,7 @@ using System.Linq;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class Document : IHasEnvelope, IHasAddedWhen
public class Document : IDocument, IHasEnvelope, IHasAddedWhen
{
public Document()
{
@@ -66,6 +66,12 @@ namespace EnvelopeGenerator.Domain.Entities
#endif
Elements { get; set; }
public IEnumerable<IDocReceiverElement>
#if nullable
?
#endif
ElementsBase => Elements;
[ForeignKey("EnvelopeId")]
public virtual Envelope
#if nullable

View File

@@ -7,5 +7,36 @@
double X { get; set; }
double Y { get; set; }
string
#if nullable
?
# endif
FullName { get; set; }
string
#if nullable
?
#endif
Place { get; set; }
byte[]
#if nullable
?
#endif
Ink { get; set; }
}
public static class DocReceiverElementExtensions
{
/// <summary>
///
/// </summary>
/// <param name="element"></param>
/// <returns></returns>
public static bool IsSigned(this IDocReceiverElement element)
=> element.FullName != null
&& element.Place != null &&
element.Ink != null;
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
namespace EnvelopeGenerator.Domain.Interfaces
{
public interface IDocument
{
IEnumerable<IDocReceiverElement>
#if nullable
?
#endif
ElementsBase { get; }
}
public static class DocumentExtensions
{
public static bool IsSigned<TElement, TElements>(this IDocument document)
{
if(document.ElementsBase == null)
throw new ArgumentNullException(nameof(document.ElementsBase), "Elements collection cannot be null. Please add with Includ()");
foreach (var element in document.ElementsBase)
if (!element.IsSigned())
return false;
return true;
}
}
}