Compare commits
6 Commits
456c591fae
...
83d29bf78d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83d29bf78d | ||
|
|
bc45aadf27 | ||
|
|
7e66cd4dae | ||
|
|
cc11d70a27 | ||
|
|
02aeaea8a9 | ||
|
|
05867cc645 |
@@ -3,19 +3,45 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing configuration settings.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class ConfigDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ConfigDto(
|
||||
string DocumentPath,
|
||||
int SendingProfile,
|
||||
string SignatureHost,
|
||||
string ExternalProgramName,
|
||||
string ExportPath) : IUnique<int>
|
||||
{
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
[Obsolete("Configuration does not have an ID; it represents a single table in the database.")]
|
||||
public int Id => throw new InvalidOperationException("This configuration does not support an ID as it represents a single row in the database.");
|
||||
};
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the document.
|
||||
/// </summary>
|
||||
public string DocumentPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sending profile identifier.
|
||||
/// </summary>
|
||||
public int SendingProfile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the signature host URL or name.
|
||||
/// </summary>
|
||||
public string SignatureHost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the external program.
|
||||
/// </summary>
|
||||
public string ExternalProgramName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path where exports will be saved.
|
||||
/// </summary>
|
||||
public string ExportPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ID of the configuration.
|
||||
/// This DTO represents a single row in the database and does not support an ID.
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
[JsonIgnore]
|
||||
[Obsolete("Configuration does not have an ID; it represents a single table in the database.")]
|
||||
public int Id => throw new InvalidOperationException("This configuration does not support an ID as it represents a single row in the database.");
|
||||
}
|
||||
@@ -1,26 +1,96 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing a positioned element assigned to a document receiver.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class DocumentReceiverElementDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record DocumentReceiverElementDto(
|
||||
int Id,
|
||||
int DocumentId,
|
||||
int ReceiverId,
|
||||
int ElementType,
|
||||
double X,
|
||||
double Y,
|
||||
double Width,
|
||||
double Height,
|
||||
int Page,
|
||||
bool Required,
|
||||
string? Tooltip,
|
||||
bool ReadOnly,
|
||||
int AnnotationIndex,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ChangedWhen,
|
||||
double Top,
|
||||
double Left
|
||||
): IUnique<int>;
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the element.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the associated document.
|
||||
/// </summary>
|
||||
public int DocumentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the receiver.
|
||||
/// </summary>
|
||||
public int ReceiverId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the element.
|
||||
/// </summary>
|
||||
public int ElementType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the X coordinate of the element.
|
||||
/// </summary>
|
||||
public double X { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Y coordinate of the element.
|
||||
/// </summary>
|
||||
public double Y { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the width of the element.
|
||||
/// </summary>
|
||||
public double Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the height of the element.
|
||||
/// </summary>
|
||||
public double Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the page number where the element appears.
|
||||
/// </summary>
|
||||
public int Page { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the element is required.
|
||||
/// </summary>
|
||||
public bool Required { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the tooltip text for the element.
|
||||
/// </summary>
|
||||
public string? Tooltip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the element is read-only.
|
||||
/// </summary>
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the annotation index for ordering or reference.
|
||||
/// </summary>
|
||||
public int AnnotationIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the element was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the element was last changed, if applicable.
|
||||
/// </summary>
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the top position of the element (in layout terms).
|
||||
/// </summary>
|
||||
public double Top { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the left position of the element (in layout terms).
|
||||
/// </summary>
|
||||
public double Left { get; set; }
|
||||
}
|
||||
@@ -1,18 +1,51 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing the status of a document for a specific receiver.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class DocumentStatusDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record DocumentStatusDto(
|
||||
int Id,
|
||||
int EnvelopeId,
|
||||
int ReceiverId,
|
||||
int Status,
|
||||
DateTime? StatusChangedWhen,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ChangedWhen) : IUnique<int>
|
||||
{
|
||||
public string? Value { get; set; }
|
||||
};
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the document status entry.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the associated envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ID of the receiver associated with this status.
|
||||
/// </summary>
|
||||
public int ReceiverId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the current status code.
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the status was changed.
|
||||
/// </summary>
|
||||
public DateTime? StatusChangedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when this record was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when this record was last changed.
|
||||
/// </summary>
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display value associated with the status.
|
||||
/// </summary>
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
@@ -1,16 +1,51 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing certificate information for an envelope.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class EnvelopeCertificateDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeCertificateDto(
|
||||
int Id,
|
||||
int EnvelopeId,
|
||||
string EnvelopeUuid,
|
||||
string EnvelopeSubject,
|
||||
int CreatorId,
|
||||
string CreatorName,
|
||||
string CreatorEmail,
|
||||
int EnvelopeStatus) : IUnique<int>;
|
||||
/// <summary>
|
||||
/// Gets the unique identifier of the certificate.
|
||||
/// </summary>
|
||||
public int Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the envelope ID associated with the certificate.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the UUID of the envelope.
|
||||
/// </summary>
|
||||
public string EnvelopeUuid { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the subject of the envelope.
|
||||
/// </summary>
|
||||
public string EnvelopeSubject { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ID of the creator of the envelope.
|
||||
/// </summary>
|
||||
public int CreatorId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the creator.
|
||||
/// </summary>
|
||||
public string CreatorName { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the email address of the creator.
|
||||
/// </summary>
|
||||
public string CreatorEmail { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current status of the envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeStatus { get; init; }
|
||||
}
|
||||
@@ -1,15 +1,36 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing a document within an envelope, including optional binary data and form elements.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class EnvelopeDocumentDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeDocumentDto
|
||||
(
|
||||
int Id,
|
||||
int EnvelopeId,
|
||||
DateTime AddedWhen,
|
||||
byte[]? ByteData = null,
|
||||
IEnumerable<DocumentReceiverElementDto>? Elements = null
|
||||
) : IUnique<int>;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the document.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the envelope ID to which the document belongs.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the document was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the binary data of the document, if available.
|
||||
/// </summary>
|
||||
public byte[]? ByteData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of elements associated with the document for receiver interactions, if any.
|
||||
/// </summary>
|
||||
public IEnumerable<DocumentReceiverElementDto>? Elements { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,53 +4,52 @@ using DigitalData.UserManager.Application.DTOs.User;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeDto() : IUnique<int>
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Id { get; set; }
|
||||
|
||||
public int UserId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
public int Status { get; set; }
|
||||
|
||||
public string StatusName { get; set; }
|
||||
public string StatusName { get; set; }
|
||||
|
||||
public string Uuid { get; set; }
|
||||
public string Uuid { get; set; }
|
||||
|
||||
[TemplatePlaceholder("[MESSAGE]")]
|
||||
public string Message { get; set; }
|
||||
[TemplatePlaceholder("[MESSAGE]")]
|
||||
public string Message { get; set; }
|
||||
|
||||
public DateTime AddedWhen { get; set; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
||||
public string Title { get; set; }
|
||||
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
|
||||
public string Title { get; set; }
|
||||
|
||||
public int? ContractType { get; set; }
|
||||
public int? ContractType { get; set; }
|
||||
|
||||
public string Language { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
||||
public int? EnvelopeTypeId { get; set; }
|
||||
public int? EnvelopeTypeId { get; set; }
|
||||
|
||||
public int? CertificationType { get; set; }
|
||||
public int? CertificationType { get; set; }
|
||||
|
||||
public bool? UseAccessCode { get; set; }
|
||||
public bool? UseAccessCode { get; set; }
|
||||
|
||||
public bool TFAEnabled { get; init; }
|
||||
public bool TFAEnabled { get; init; }
|
||||
|
||||
public UserReadDto? User { get; set; }
|
||||
public UserReadDto? User { get; set; }
|
||||
|
||||
public EnvelopeType? EnvelopeType { get; set; }
|
||||
public EnvelopeType? EnvelopeType { get; set; }
|
||||
|
||||
public string? EnvelopeTypeTitle { get; set; }
|
||||
public string? EnvelopeTypeTitle { get; set; }
|
||||
|
||||
public bool IsAlreadySent { get; set; }
|
||||
public bool IsAlreadySent { get; set; }
|
||||
|
||||
public byte[]? DocResult { get; init; }
|
||||
public byte[]? DocResult { get; init; }
|
||||
|
||||
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
|
||||
}
|
||||
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
|
||||
}
|
||||
@@ -1,12 +1,34 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object for creating a new envelope history record.
|
||||
/// </summary>
|
||||
public class EnvelopeHistoryCreateDto
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeHistoryCreateDto(
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
int Status,
|
||||
DateTime? ActionDate,
|
||||
string? Comment = null);
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user reference associated with the action.
|
||||
/// </summary>
|
||||
public required string UserReference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the status of the envelope at the time of the action.
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the action occurred.
|
||||
/// </summary>
|
||||
public DateTime? ActionDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an optional comment related to the action.
|
||||
/// </summary>
|
||||
public string? Comment { get; set; }
|
||||
}
|
||||
@@ -1,36 +1,73 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.UserManager.Application.DTOs.User;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Data Transfer Object representing the history of an envelope, including status, sender, receiver, and related metadata.
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <param name="EnvelopeId"></param>
|
||||
/// <param name="UserReference"></param>
|
||||
/// <param name="Status"></param>
|
||||
/// <param name="StatusName"></param>
|
||||
/// <param name="AddedWhen"></param>
|
||||
/// <param name="ActionDate"></param>
|
||||
/// <param name="Sender"></param>
|
||||
/// <param name="Receiver"></param>
|
||||
/// <param name="ReferenceType"></param>
|
||||
/// <param name="Comment"></param>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeHistoryDto(
|
||||
long Id,
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
int Status,
|
||||
string? StatusName,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ActionDate,
|
||||
UserCreateDto? Sender,
|
||||
ReceiverReadDto? Receiver,
|
||||
ReferenceType ReferenceType,
|
||||
string? Comment = null) : BaseDTO<long>(Id), IUnique<long>;
|
||||
public record EnvelopeHistoryDto : IUnique<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// Unique identifier for the envelope history entry.
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Identifier of the associated envelope.
|
||||
/// </summary>
|
||||
public int EnvelopeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reference string for the user related to this history entry.
|
||||
/// </summary>
|
||||
public string UserReference { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Status code of the envelope at this history point.
|
||||
/// </summary>
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Human-readable name of the status.
|
||||
/// </summary>
|
||||
public string? StatusName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date and time when this history entry was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date and time when an action was performed, if applicable.
|
||||
/// </summary>
|
||||
public DateTime? ActionDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the sender associated with this history entry.
|
||||
/// </summary>
|
||||
public UserCreateDto? Sender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the receiver associated with this history entry.
|
||||
/// </summary>
|
||||
public ReceiverReadDto? Receiver { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of reference for this history entry.
|
||||
/// </summary>
|
||||
public ReferenceType ReferenceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional comment related to this history entry.
|
||||
/// </summary>
|
||||
public string? Comment { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,18 +1,62 @@
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a read-only Data Transfer Object (DTO) for an envelope receiver.
|
||||
/// Contains information about the receiver, associated envelope, and audit details.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class EnvelopeReceiverReadOnlyDto
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverReadOnlyDto(
|
||||
long Id,
|
||||
long EnvelopeId,
|
||||
string ReceiverMail,
|
||||
DateTime DateValid,
|
||||
DateTime AddedWhen,
|
||||
string AddedWho,
|
||||
EnvelopeDto? Envelope = null,
|
||||
string? ChangedWho = null,
|
||||
DateTime? ChangedWhen = null,
|
||||
ReceiverReadDto? Receiver = null);
|
||||
/// <summary>
|
||||
/// Gets or inits the unique identifier of the envelope receiver.
|
||||
/// </summary>
|
||||
public long Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the identifier of the associated envelope.
|
||||
/// </summary>
|
||||
public long EnvelopeId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the email address of the receiver.
|
||||
/// </summary>
|
||||
public string ReceiverMail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the date until which the receiver is valid.
|
||||
/// </summary>
|
||||
public DateTime DateValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the date and time when the receiver was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the user who added the receiver.
|
||||
/// </summary>
|
||||
public string AddedWho { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the associated envelope details.
|
||||
/// </summary>
|
||||
public EnvelopeDto? Envelope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the user who last changed the receiver, if any.
|
||||
/// </summary>
|
||||
public string? ChangedWho { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the date and time when the receiver was last changed, if any.
|
||||
/// </summary>
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or inits the associated receiver details.
|
||||
/// </summary>
|
||||
public ReceiverReadDto? Receiver { get; set; }
|
||||
}
|
||||
@@ -1,14 +1,31 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object for updating a read-only envelope receiver.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class EnvelopeReceiverReadOnlyUpdateDto : IUnique<long>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeReceiverReadOnlyUpdateDto(
|
||||
long Id,
|
||||
DateTime DateValid,
|
||||
string ChangedWho) : IUnique<long>
|
||||
{
|
||||
public DateTime ChangedWhen { get; } = DateTime.Now;
|
||||
};
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the envelope receiver.
|
||||
/// </summary>
|
||||
public long Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date when the envelope receiver becomes valid.
|
||||
/// </summary>
|
||||
public DateTime DateValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user who made the change.
|
||||
/// </summary>
|
||||
public string ChangedWho { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date and time when the change was made.
|
||||
/// </summary>
|
||||
public DateTime ChangedWhen { get; set; } = DateTime.Now;
|
||||
}
|
||||
@@ -1,23 +1,86 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing a type of envelope with its configuration settings.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class EnvelopeTypeDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record EnvelopeTypeDto(
|
||||
int Id,
|
||||
string Title,
|
||||
string Language,
|
||||
int? ExpiresDays,
|
||||
int? CertificationType,
|
||||
bool? UseAccessCode,
|
||||
int? FinalEmailToCreator,
|
||||
int? FinalEmailToReceivers,
|
||||
DateTime AddedWhen,
|
||||
DateTime? ChangedWhen,
|
||||
int? ExpiresWarningDays,
|
||||
bool? SendReminderEmails,
|
||||
int? FirstReminderDays,
|
||||
int? ReminderIntervalDays,
|
||||
int? ContractType) : IUnique<int>;
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the envelope type.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the title of the envelope type.
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the language code used in this envelope type.
|
||||
/// </summary>
|
||||
public string Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of days after which the envelope expires.
|
||||
/// </summary>
|
||||
public int? ExpiresDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the certification type identifier.
|
||||
/// </summary>
|
||||
public int? CertificationType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether an access code is required.
|
||||
/// </summary>
|
||||
public bool? UseAccessCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the final email template ID to be sent to the creator.
|
||||
/// </summary>
|
||||
public int? FinalEmailToCreator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the final email template ID to be sent to the receivers.
|
||||
/// </summary>
|
||||
public int? FinalEmailToReceivers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when this envelope type was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when this envelope type was last changed.
|
||||
/// </summary>
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of days before expiry when a warning should be sent.
|
||||
/// </summary>
|
||||
public int? ExpiresWarningDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether reminder emails should be sent.
|
||||
/// </summary>
|
||||
public bool? SendReminderEmails { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of days before the first reminder is sent.
|
||||
/// </summary>
|
||||
public int? FirstReminderDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the interval in days between reminder emails.
|
||||
/// </summary>
|
||||
public int? ReminderIntervalDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the contract type associated with the envelope type.
|
||||
/// </summary>
|
||||
public int? ContractType { get; set; }
|
||||
}
|
||||
@@ -3,21 +3,30 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverCreateDto([EmailAddress] string EmailAddress, string? TotpSecretkey = null)
|
||||
{
|
||||
public string Signature => sha256HexOfMail.Value;
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
private readonly Lazy<string> sha256HexOfMail = new(() =>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverCreateDto
|
||||
{
|
||||
public ReceiverCreateDto()
|
||||
{
|
||||
_sha256HexOfMail = new(() =>
|
||||
{
|
||||
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());
|
||||
var hash_arr = SHA256.HashData(bytes_arr);
|
||||
var hexa_str = BitConverter.ToString(hash_arr);
|
||||
return hexa_str.Replace("-", string.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
||||
};
|
||||
}
|
||||
[EmailAddress]
|
||||
public required string EmailAddress { get; init; }
|
||||
|
||||
public string? TotpSecretkey { get; init; }
|
||||
|
||||
public string Signature => _sha256HexOfMail.Value;
|
||||
|
||||
private readonly Lazy<string> _sha256HexOfMail;
|
||||
|
||||
public DateTime AddedWhen { get; } = DateTime.Now;
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text.Json.Serialization;
|
||||
@@ -7,19 +6,27 @@ using System.Text.Json.Serialization;
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverReadDto(
|
||||
int Id,
|
||||
string EmailAddress,
|
||||
string Signature,
|
||||
DateTime AddedWhen
|
||||
) : BaseDTO<int>(Id), IUnique<int>
|
||||
public class ReceiverReadDto : IUnique<int>
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
public string Signature { get; set; }
|
||||
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; init; }
|
||||
public IEnumerable<EnvelopeReceiverBasicDto>? EnvelopeReceivers { get; set; }
|
||||
|
||||
public string? LastUsedName => EnvelopeReceivers?.LastOrDefault()?.Name;
|
||||
|
||||
public string? TotpSecretkey { get; set; } = null;
|
||||
|
||||
public DateTime? TfaRegDeadline { get; set; }
|
||||
};
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Id.GetHashCode();
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,26 @@ using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object for updating a receiver's information.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record ReceiverUpdateDto(int Id, string? TotpSecretkey = null, DateTime? TfaRegDeadline = null) : IUnique<int>;
|
||||
public class ReceiverUpdateDto : IUnique<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the receiver.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the TOTP (Time-based One-Time Password) secret key.
|
||||
/// Optional.
|
||||
/// </summary>
|
||||
public string? TotpSecretkey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the deadline for two-factor authentication registration.
|
||||
/// Optional.
|
||||
/// </summary>
|
||||
public DateTime? TfaRegDeadline { get; set; }
|
||||
}
|
||||
@@ -1,15 +1,46 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs;
|
||||
|
||||
/// <summary>
|
||||
/// Data Transfer Object representing a user receiver with associated details.
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public class UserReceiverDto : IUnique<int>
|
||||
{
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public record UserReceiverDto(
|
||||
int Id,
|
||||
int UserId,
|
||||
int ReceiverId,
|
||||
string Name,
|
||||
string CompanyName,
|
||||
string JobTitle,
|
||||
DateTime AddedWhen) : IUnique<int>;
|
||||
/// <summary>
|
||||
/// Gets or sets the unique identifier of the user receiver.
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the user associated with the receiver.
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the receiver.
|
||||
/// </summary>
|
||||
public int ReceiverId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the receiver.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the company name of the receiver.
|
||||
/// </summary>
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the job title of the receiver.
|
||||
/// </summary>
|
||||
public string JobTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the user receiver was added.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; set; }
|
||||
}
|
||||
@@ -76,7 +76,14 @@ public class EnvelopeHistoryService : CRUDService<IEnvelopeHistoryRepository, En
|
||||
}
|
||||
|
||||
public async Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null) =>
|
||||
await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now, Comment: comment))
|
||||
await CreateAsync(new ()
|
||||
{
|
||||
EnvelopeId = envelopeId,
|
||||
UserReference = userReference,
|
||||
Status = (int) status,
|
||||
ActionDate = DateTime.Now,
|
||||
Comment = comment
|
||||
})
|
||||
.ThenAsync(
|
||||
Success: id => Result.Success(id),
|
||||
Fail: (mssg, ntc) => Result.Fail<long>().Message(mssg).Notice(ntc)
|
||||
|
||||
@@ -33,7 +33,7 @@ public static class DIExtensions
|
||||
/// will be created per HTTP request (or per scope) within the dependency injection container.
|
||||
/// </remarks>
|
||||
public static IServiceCollection AddEnvelopeGeneratorInfrastructureServices(this IServiceCollection services,
|
||||
Action<DbContextOptionsBuilder>? dbContextOptions = null,
|
||||
Action<IServiceProvider, DbContextOptionsBuilder>? dbContextOptions = null,
|
||||
IConfiguration? sqlExecutorConfiguration = null,
|
||||
Action<SQLExecutorParams>? sqlExecutorConfigureOptions = null)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,14 @@ try
|
||||
});
|
||||
|
||||
// Add envelope generator services
|
||||
builder.Services.AddEnvelopeGeneratorInfrastructureServices(options => options.UseSqlServer(connStr));
|
||||
builder.Services.AddEnvelopeGeneratorInfrastructureServices((provider, options) =>
|
||||
{
|
||||
var logger = provider.GetRequiredService<ILogger<EGDbContext>>();
|
||||
options.UseSqlServer(connStr)
|
||||
.LogTo(log => logger.LogInformation("{log}", log), Microsoft.Extensions.Logging.LogLevel.Trace)
|
||||
.EnableSensitiveDataLogging()
|
||||
.EnableDetailedErrors();
|
||||
});
|
||||
|
||||
builder.Services.AddEnvelopeGeneratorServices(config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user