Compare commits

..

8 Commits

Author SHA1 Message Date
Developer 02
bdf2527fc1 Refactor using directives and add User entity
- Updated `using` directives in `Config.cs` and `EnvelopeType.cs` to include additional namespaces and removed `DigitalData.Core.Abstractions`.
- Adjusted formatting for `StatusName` and `IsAlreadySent` properties in `Envelope.cs` for consistency.
- Simplified `User` property in `Envelope.cs` by removing the namespace prefix.
- Introduced a new `User` class in `User.cs` with various properties and data annotations for database mapping.
- Removed the `<Nullable>` property from `EnvelopeGenerator.Domain.csproj`, which may impact nullability handling.
2025-05-16 09:56:44 +02:00
Developer 02
1a69478f48 Refactor entity classes for non-nullable properties
Removed nullable types and `init` properties, replacing them with standard getters and setters in various entity classes. Updated properties like `DocumentPath`, `SendingProfile`, and `SignatureHost` to be non-nullable and added required attributes.

Modified the project file to include `net462` as a target framework and added a reference for `System.ComponentModel.Annotations`. Removed the `IUnique<int>` interface from several classes to simplify uniqueness management.

These changes improve data integrity and usability across the entity classes.
2025-05-14 09:16:02 +02:00
Developer 02
83d29bf78d Add EmailProfilerDispatcher and enhance logging
Included the DigitalData.EmailProfilerDispatcher namespace in Program.cs for email profiling functionality. Removed Microsoft.Extensions.DependencyInjection namespace to streamline dependency management. Enhanced logging configuration by adding EnableDetailedErrors() for improved error messages during development while retaining EnableSensitiveDataLogging().
2025-05-13 13:44:13 +02:00
Developer 02
bc45aadf27 Refactor RecordAsync object initialization
Updated the `RecordAsync` method in the `EnvelopeHistoryService` class to use an explicit object initializer with braces for creating a new object in the `CreateAsync` method. This change improves code clarity while maintaining the same functionality.
2025-05-13 11:21:01 +02:00
Developer 02
7e66cd4dae Refactor DTOs for improved structure and documentation
Transitioned from records to classes for flexibility, added XML documentation for clarity, and updated property definitions to use standard getters and setters. Introduced the `required` keyword for essential properties, removed unnecessary constructors, and enhanced property descriptions for better readability. Additionally, overridden `GetHashCode` in `ReceiverReadDto` for proper collection behavior.
2025-05-13 11:05:43 +02:00
Developer 02
cc11d70a27 Refactor DTOs to classes with enhanced properties
Changed `EnvelopeReceiverReadOnlyDto` and `EnvelopeReceiverReadOnlyUpdateDto` from records to classes, converting properties to standard get/set accessors and adding documentation comments. Introduced a default value for `ChangedWhen` in `EnvelopeReceiverReadOnlyUpdateDto`.

Modified `ReceiverCreateDto` to a class structure, updating properties to use init-only accessors and encapsulating SHA256 hash logic in a private field. Retained the `AddedWhen` property with its default value.
2025-05-13 09:56:56 +02:00
Developer 02
02aeaea8a9 Refactor EnvelopeHistoryDto to use properties
The EnvelopeHistoryDto class has been changed from a record type with positional parameters to a traditional class structure with explicit properties. This refactor improves readability and maintainability, and includes XML documentation for each property. The GetHashCode method has also been overridden to ensure uniqueness based on the Id property.
2025-05-12 16:36:21 +02:00
Developer 02
05867cc645 Update DIExtensions for enhanced DbContext configuration
Modified the `AddEnvelopeGeneratorInfrastructureServices` method to accept a service provider, allowing for more complex DbContext configurations. Added a using directive for `Microsoft.Extensions.DependencyInjection` in `Program.cs`. Updated the method call to utilize the new signature, enabling logging of SQL commands and sensitive data during database operations.
2025-05-12 16:35:48 +02:00
34 changed files with 908 additions and 379 deletions

View File

@@ -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.");
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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();
}
};

View File

@@ -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; }
}

View File

@@ -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;
}

View File

@@ -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; }
}

View File

@@ -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;
};

View File

@@ -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();
}
}

View File

@@ -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; }
}

View File

@@ -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; }
}

View File

@@ -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)

View File

@@ -1,28 +1,27 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_CONFIG", Schema = "dbo")]
public class Config : IUnique<int>
public class Config
{
[Column("DOCUMENT_PATH", TypeName = "nvarchar(256)")]
public string? DocumentPath { get; init; }
public string DocumentPath { get; set; }
[Column("SENDING_PROFILE", TypeName = "int")]
[Required]
public required int SendingProfile { get; init; }
public int SendingProfile { get; set; }
[Column("SIGNATURE_HOST", TypeName = "nvarchar(128)")]
public string? SignatureHost { get; init; }
public string SignatureHost { get; set; }
[Column("EXTERNAL_PROGRAM_NAME", TypeName = "nvarchar(30)")]
public string? ExternalProgramName { get; init; }
public string ExternalProgramName { get; set; }
[Column("EXPORT_PATH", TypeName = "nvarchar(256)")]
public string? ExportPath { get; init; }
public string ExportPath { get; set; }
[Obsolete("Configuration does not have an ID; it represents a single table in the database.")]
[NotMapped]

View File

@@ -1,12 +1,11 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
public class DocumentReceiverElement : IUnique<int>
public class DocumentReceiverElement
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -57,7 +56,7 @@ namespace EnvelopeGenerator.Domain.Entities
public bool Required { get; set; }
[Column("TOOLTIP")]
public string? Tooltip { get; set; }
public string Tooltip { get; set; }
[Required]
[Column("READ_ONLY")]
@@ -75,13 +74,13 @@ namespace EnvelopeGenerator.Domain.Entities
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
[ForeignKey("DocumentId")]
public virtual EnvelopeDocument? Document { get; set; }
public virtual EnvelopeDocument Document { get; set; }
[ForeignKey("ReceiverId")]
public virtual Receiver? Receiver { get; set; }
public virtual Receiver Receiver { get; set; }
[NotMapped]
public double Top => Math.Round(Y, 5);

View File

@@ -1,11 +1,10 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_DOCUMENT_STATUS", Schema = "dbo")]
public class DocumentStatus : IUnique<int>
public class DocumentStatus
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -25,22 +24,22 @@ namespace EnvelopeGenerator.Domain.Entities
public int Status { get; set; }
[Column("STATUS_CHANGED_WHEN", TypeName = "datetime")]
public DateTime? StatusChangedWhen { get; set; }
public DateTime StatusChangedWhen { get; set; }
[Column("VALUE", TypeName = "nvarchar(max)")]
public string? Value { get; set; }
public string Value { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
[ForeignKey("EnvelopeId")]
public virtual Envelope? Envelope { get; set; }
public virtual Envelope Envelope { get; set; }
[ForeignKey("ReceiverId")]
public virtual Receiver? Receiver { get; set; }
public virtual Receiver Receiver { get; set; }
}
}

View File

@@ -1,12 +1,11 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_EMAIL_TEMPLATE", Schema = "dbo")]
public class EmailTemplate : IUnique<int>
public class EmailTemplate
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -14,13 +13,13 @@ namespace EnvelopeGenerator.Domain.Entities
public int Id { get; set; }
[Column("NAME", TypeName = "nvarchar(64)")]
public string? Name { get; set; }
public string Name { get; set; }
[Column("BODY", TypeName = "nvarchar(max)")]
public string? Body { get; set; }
public string Body { get; set; }
[Column("SUBJECT", TypeName = "nvarchar(512)")]
public string? Subject { get; set; }
public string Subject { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
@@ -28,6 +27,6 @@ namespace EnvelopeGenerator.Domain.Entities
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
}
}

View File

@@ -1,12 +1,11 @@
using DigitalData.Core.Abstractions;
using EnvelopeGenerator.Common;
using EnvelopeGenerator.Common;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE", Schema = "dbo")]
public class Envelope : IUnique<int>
public class Envelope
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -22,90 +21,90 @@ namespace EnvelopeGenerator.Domain.Entities
public int Status { get; set; }
[NotMapped]
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
[Required]
[Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")]
public required string Uuid { get; init; }
public string Uuid { get; set; }
[Column("MESSAGE", TypeName = "nvarchar(max)")]
public string? Message { get; set; }
public string Message { get; set; }
[Column("EXPIRES_WHEN", TypeName = "datetime")]
public DateTime? ExpiresWhen { get; set; }
public DateTime ExpiresWhen { get; set; }
[Column("EXPIRES_WARNING_WHEN", TypeName = "datetime")]
public DateTime? ExpiresWarningWhen { get; set; }
public DateTime ExpiresWarningWhen { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
[Column("TITLE", TypeName = "nvarchar(128)")]
public string? Title { get; set; }
public string Title { get; set; }
[Column("CONTRACT_TYPE")]
public int? ContractType { get; set; }
public int ContractType { get; set; }
[Column("LANGUAGE", TypeName = "nvarchar(5)")]
public string? Language { get; set; }
public string Language { get; set; }
[Column("SEND_REMINDER_EMAILS")]
public bool? SendReminderEmails { get; set; }
public bool SendReminderEmails { get; set; }
[Column("FIRST_REMINDER_DAYS")]
public int? FirstReminderDays { get; set; }
public int FirstReminderDays { get; set; }
[Column("REMINDER_INTERVAL_DAYS")]
public int? ReminderIntervalDays { get; set; }
public int ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")]
public int? EnvelopeTypeId { get; set; }
public int EnvelopeTypeId { get; set; }
[Column("CERTIFICATION_TYPE")]
public int? CertificationType { get; set; }
public int CertificationType { get; set; }
[Column("USE_ACCESS_CODE")]
public bool? UseAccessCode { get; set; }
public bool UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public int? FinalEmailToCreator { get; set; }
public int FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public int? FinalEmailToReceivers { get; set; }
public int FinalEmailToReceivers { get; set; }
[Column("EXPIRES_WHEN_DAYS")]
public int? ExpiresWhenDays { get; set; }
public int ExpiresWhenDays { get; set; }
[Column("EXPIRES_WARNING_WHEN_DAYS")]
public int? ExpiresWarningWhenDays { get; set; }
public int ExpiresWarningWhenDays { get; set; }
[Column("TFA_ENABLED", TypeName = "bit")]
public bool TFAEnabled { get; set; }
[Column("DOC_RESULT", TypeName = "varbinary(max)")]
public byte[]? DocResult { get; init; }
public byte[] DocResult { get; set; }
/// <summary>
/// The sender of envelope
/// </summary>
[ForeignKey("UserId")]
public DigitalData.UserManager.Domain.Entities.User? User { get; set; }
public User User { get; set; }
[ForeignKey("EnvelopeTypeId")]
public EnvelopeType? EnvelopeType { get; set; }
public EnvelopeType EnvelopeType { get; set; }
[NotMapped]
public string? EnvelopeTypeTitle => EnvelopeType?.Title;
public string EnvelopeTypeTitle => EnvelopeType.Title;
[NotMapped]
public bool IsAlreadySent => Status > (int) Constants.EnvelopeStatus.EnvelopeSaved;
public bool IsAlreadySent => Status > (int)Constants.EnvelopeStatus.EnvelopeSaved;
public IEnumerable<EnvelopeDocument>? Documents { get; set; }
public IEnumerable<EnvelopeDocument> Documents { get; set; }
public IEnumerable<EnvelopeHistory>? History { get; set; }
public IEnumerable<EnvelopeHistory> History { get; set; }
}
}

View File

@@ -1,11 +1,10 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_CERTIFICATE", Schema = "dbo")]
public class EnvelopeCertificate : IUnique<int>
public class EnvelopeCertificate
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -18,11 +17,11 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")]
public required string EnvelopeUuid { get; set; }
public string EnvelopeUuid { get; set; }
[Required]
[Column("ENVELOPE_SUBJECT", TypeName = "nvarchar(512)")]
public required string EnvelopeSubject { get; set; }
public string EnvelopeSubject { get; set; }
[Required]
[Column("CREATOR_ID")]
@@ -30,11 +29,11 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("CREATOR_NAME", TypeName = "nvarchar(128)")]
public required string CreatorName { get; set; }
public string CreatorName { get; set; }
[Required]
[Column("CREATOR_EMAIL", TypeName = "nvarchar(128)")]
public required string CreatorEmail { get; set; }
public string CreatorEmail { get; set; }
[Required]
[Column("ENVELOPE_STATUS")]

View File

@@ -1,27 +1,27 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities;
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class EnvelopeDocument : IUnique<int>
namespace EnvelopeGenerator.Domain.Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class EnvelopeDocument
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
[Required]
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public required DateTime AddedWhen { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("BYTE_DATA", TypeName = "varbinary(max)")]
public byte[]? ByteData { get; init; }
[Column("BYTE_DATA", TypeName = "varbinary(max)")]
public byte[] ByteData { get; set; }
public IEnumerable<DocumentReceiverElement>? Elements { get; set; }
public IEnumerable<DocumentReceiverElement> Elements { get; set; }
}
}

View File

@@ -1,12 +1,10 @@
using DigitalData.Core.Abstractions;
using DigitalData.UserManager.Domain.Entities;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_HISTORY", Schema = "dbo")]
public class EnvelopeHistory : IUnique<long>
public class EnvelopeHistory
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -19,7 +17,7 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("USER_REFERENCE", TypeName = "nvarchar(128)")]
public required string UserReference { get; init; }
public string UserReference { get; set; }
[Required]
[Column("STATUS")]
@@ -31,15 +29,15 @@ namespace EnvelopeGenerator.Domain.Entities
public DateTime AddedWhen { get; set; }
[Column("ACTION_DATE", TypeName = "datetime")]
public DateTime? ActionDate { get; set; }
public DateTime ActionDate { get; set; }
[Column("COMMENT", TypeName = "nvarchar(max)")]
public string? Comment { get; set; }
public string Comment { get; set; }
[ForeignKey("UserReference")]
public virtual User? Sender { get; set; }
public virtual User Sender { get; set; }
[ForeignKey("UserReference")]
public virtual Receiver? Receiver { get; set; }
public virtual Receiver Receiver { get; set; }
}
}

View File

@@ -6,9 +6,9 @@ namespace EnvelopeGenerator.Domain.Entities
public class EnvelopeReceiver : EnvelopeReceiverBase
{
[ForeignKey("EnvelopeId")]
public Envelope? Envelope { get; set; }
public Envelope Envelope { get; set; }
[ForeignKey("ReceiverId")]
public Receiver? Receiver { get; set; }
public Receiver Receiver { get; set; }
}
}

View File

@@ -1,11 +1,10 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
public class EnvelopeReceiverBase : IUnique<(int Envelope, int Receiver)>
public class EnvelopeReceiverBase
{
[Key]
[Column("ENVELOPE_ID")]
@@ -20,31 +19,31 @@ namespace EnvelopeGenerator.Domain.Entities
public int Sequence { get; set; }
[Column("NAME", TypeName = "nvarchar(128)")]
public string? Name { get; set; }
public string Name { get; set; }
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
public string? JobTitle { get; set; }
public string JobTitle { get; set; }
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
public string? CompanyName { get; set; }
public string CompanyName { get; set; }
[Column("PRIVATE_MESSAGE", TypeName = "nvarchar(max)")]
public string? PrivateMessage { get; set; }
public string PrivateMessage { get; set; }
[Column("ACCESS_CODE", TypeName = "nvarchar(64)")]
public string? AccessCode { get; set; }
public string AccessCode { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
[Column("PHONE_NUMBER")]
[StringLength(20)]
[RegularExpression(@"^\+[0-9]+$", ErrorMessage = "Phone number must start with '+' followed by digits.")]
public string? PhoneNumber { get; set; }
public string PhoneNumber { get; set; }
[NotMapped]
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);

View File

@@ -1,52 +1,50 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using DigitalData.Core.Abstractions;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_RECEIVER_READ_ONLY")]
public class EnvelopeReceiverReadOnly : IUnique<long>
public class EnvelopeReceiverReadOnly
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public long Id { get; init; }
public long Id { get; set; }
[Column("ENVELOPE_ID")]
[Required]
public long EnvelopeId { get; init; }
public long EnvelopeId { get; set; }
//TODO: remove NotMapped attribute when EnvelopeId data type is standardized
[NotMapped]
public Envelope? Envelope { get; set; }
public Envelope Envelope { get; set; }
[Column("RECEIVER_MAIL")]
[Required]
[StringLength(250)]
[TemplatePlaceholder("NAME_RECEIVER")]
public required string ReceiverMail { get; init; }
public string ReceiverMail { get; set; }
[Column("DATE_VALID")]
[Required]
public DateTime DateValid { get; init; }
public DateTime DateValid { get; set; }
[Column("ADDED_WHO")]
[Required]
[StringLength(100)]
public required string AddedWho { get; init; }
public string AddedWho { get; set; }
public Receiver? Receiver { get; init; }
public Receiver Receiver { get; set; }
[Column("ADDED_WHEN")]
[Required]
public DateTime AddedWhen { get; init; }
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHO")]
[StringLength(100)]
public string? ChangedWho { get; init; }
public string ChangedWho { get; set; }
[Column("CHANGED_WHEN")]
public DateTime? ChangedWhen { get; init; }
public DateTime ChangedWhen { get; set; }
}
}

View File

@@ -1,11 +1,10 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_TYPE", Schema = "dbo")]
public class EnvelopeType : IUnique<int>
public class EnvelopeType
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -14,46 +13,46 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("TITLE", TypeName = "nvarchar(128)")]
public required string Title { get; set; }
public string Title { get; set; }
[Column("LANGUAGE", TypeName = "nvarchar(5)")]
public string? Language { get; set; }
public string Language { get; set; }
[Column("EXPIRES_DAYS")]
public int? ExpiresDays { get; set; }
public int ExpiresDays { get; set; }
[Column("CERTIFICATION_TYPE")]
public int? CertificationType { get; set; }
public int CertificationType { get; set; }
[Column("USE_ACCESS_CODE")]
public bool? UseAccessCode { get; set; }
public bool UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public int? FinalEmailToCreator { get; set; }
public int FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public int? FinalEmailToReceivers { get; set; }
public int FinalEmailToReceivers { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
public DateTime ChangedWhen { get; set; }
[Column("EXPIRES_WARNING_DAYS")]
public int? ExpiresWarningDays { get; set; }
public int ExpiresWarningDays { get; set; }
[Column("SEND_REMINDER_EMAILS")]
public bool? SendReminderEmails { get; set; }
public bool SendReminderEmails { get; set; }
[Column("FIRST_REMINDER_DAYS")]
public int? FirstReminderDays { get; set; }
public int FirstReminderDays { get; set; }
[Column("REMINDER_INTERVAL_DAYS")]
public int? ReminderIntervalDays { get; set; }
public int ReminderIntervalDays { get; set; }
[Column("CONTRACT_TYPE")]
public int? ContractType { get; set; }
public int ContractType { get; set; }
}
}

View File

@@ -1,34 +1,34 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities;
[Table("TBSIG_RECEIVER", Schema = "dbo")]
public class Receiver : IUnique<int>
namespace EnvelopeGenerator.Domain.Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required, EmailAddress]
[Column("EMAIL_ADDRESS", TypeName = "nvarchar(128)")]
public required string EmailAddress { get; set; }
[Table("TBSIG_RECEIVER", Schema = "dbo")]
public class Receiver
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("SIGNATURE", TypeName = "nvarchar(64)")]
public required string Signature { get; set; }
[Required, EmailAddress]
[Column("EMAIL_ADDRESS", TypeName = "nvarchar(128)")]
public string EmailAddress { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Required]
[Column("SIGNATURE", TypeName = "nvarchar(64)")]
public string Signature { get; set; }
[Column("TOTP_SECRET_KEY", TypeName = "nvarchar(MAX)")]
public string? TotpSecretkey { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("TFA_REG_DEADLINE", TypeName = "datetime")]
public DateTime? TfaRegDeadline { get; set; }
[Column("TOTP_SECRET_KEY", TypeName = "nvarchar(MAX)")]
public string TotpSecretkey { get; set; }
public IEnumerable<EnvelopeReceiver>? EnvelopeReceivers { get; init; }
[Column("TFA_REG_DEADLINE", TypeName = "datetime")]
public DateTime TfaRegDeadline { get; set; }
public IEnumerable<EnvelopeReceiver> EnvelopeReceivers { get; set; }
}
}

View File

@@ -0,0 +1,96 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBDD_USER", Schema = "dbo")]
public class User
{
[Column("GUID")]
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[StringLength(50)]
[Column("ADDED_WHO")]
public string AddedWho { get; set; }
[StringLength(50)]
[Column("CHANGED_WHO")]
public string ChangedWho { get; set; }
//TODO: assign it to default value in create dto, not here!
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]
public DateTime AddedWhen { get; set; } = DateTime.Now;
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime ChangedWhen { get; set; }
[Column("PRENAME")]
[StringLength(50)]
public string Prename { get; set; }
[Column("NAME")]
[StringLength(50)]
public string Name { get; set; }
[Required]
[Column("USERNAME")]
[StringLength(50)]
public string Username { get; set; }
[Column("SHORTNAME")]
[StringLength(30)]
public string Shortname { get; set; }
[Column("EMAIL")]
[StringLength(100)]
public string Email { get; set; }
[Required]
[Column("LANGUAGE")]
[StringLength(5)]
[DefaultValue("de-DE")]
public string Language { get; set; }
[Column("COMMENT")]
[StringLength(500)]
public string Comment { get; set; }
[Column("DELETED")]
public bool Deleted { get; set; }
[Required]
[Column("DATE_FORMAT")]
[StringLength(10)]
[DefaultValue("dd.MM.yyyy")]
public string DateFormat { get; set; }
[Required]
[Column("ACTIVE")]
public bool Active { get; set; }
[Required]
[Column("GENERAL_VIEWER")]
[StringLength(30)]
[DefaultValue("NONE")]
public string GeneralViewer { get; set; }
[Required]
[Column("WAN_ENVIRONMENT")]
public bool WanEnvironment { get; set; }
[Required]
[Column("USERID_FK_INT_ECM")]
public int UseridFkIntEcm { get; set; }
[Column("DELETED_WHEN")]
public DateTime DeletedWhen { get; set; }
[Column("DELETED_WHO")]
[StringLength(50)]
public string DeletedWho { get; set; }
}
}

View File

@@ -1,11 +1,10 @@
using DigitalData.Core.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_USER_RECEIVER", Schema = "dbo")]
public class UserReceiver : IUnique<int>
public class UserReceiver
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
@@ -22,16 +21,16 @@ namespace EnvelopeGenerator.Domain.Entities
[Required]
[Column("NAME", TypeName = "nvarchar(128)")]
public required string Name { get; set; }
public string Name { get; set; }
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
public string? CompanyName { get; set; }
public string CompanyName { get; set; }
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
public string? JobTitle { get; set; }
public string JobTitle { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public required DateTime AddedWhen { get; init; }
public DateTime AddedWhen { get; set; }
}
}

View File

@@ -1,15 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net462;net7.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.6.0" />
<PackageReference Include="DigitalData.EmailProfilerDispatcher.Abstraction" Version="3.0.0" />
<PackageReference Include="UserManager.Domain" Version="3.0.2" />
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -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)
{

View File

@@ -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);