Refactor: Aktualisierung von APIs und Anwendungsschichten zur Umsetzung von Änderungen im Bereich

This commit is contained in:
Developer 02
2025-05-28 12:55:11 +02:00
parent c1d46b446a
commit 3c60f31050
91 changed files with 1712 additions and 535 deletions

View File

@@ -11,7 +11,7 @@ public class ConfigDto
/// <summary>
/// Gets or sets the path to the document.
/// </summary>
public string DocumentPath { get; set; }
public string? DocumentPath { get; set; }
/// <summary>
/// Gets or sets the sending profile identifier.
@@ -21,15 +21,15 @@ public class ConfigDto
/// <summary>
/// Gets or sets the signature host URL or name.
/// </summary>
public string SignatureHost { get; set; }
public string? SignatureHost { get; set; }
/// <summary>
/// Gets or sets the name of the external program.
/// </summary>
public string ExternalProgramName { get; set; }
public string? ExternalProgramName { get; set; }
/// <summary>
/// Gets or sets the path where exports will be saved.
/// </summary>
public string ExportPath { get; set; }
public string? ExportPath { get; set; }
}

View File

@@ -21,12 +21,12 @@ public class EnvelopeCertificateDto
/// <summary>
/// Gets the UUID of the envelope.
/// </summary>
public string EnvelopeUuid { get; init; }
public string EnvelopeUuid { get; init; } = string.Empty;
/// <summary>
/// Gets the subject of the envelope.
/// </summary>
public string EnvelopeSubject { get; init; }
public string EnvelopeSubject { get; init; } = string.Empty;
/// <summary>
/// Gets the ID of the creator of the envelope.
@@ -36,12 +36,12 @@ public class EnvelopeCertificateDto
/// <summary>
/// Gets the name of the creator.
/// </summary>
public string CreatorName { get; init; }
public string CreatorName { get; init; } = string.Empty;
/// <summary>
/// Gets the email address of the creator.
/// </summary>
public string CreatorEmail { get; init; }
public string CreatorEmail { get; init; } = string.Empty;
/// <summary>
/// Gets the current status of the envelope.

View File

@@ -5,50 +5,116 @@ using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs;
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeDto
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
public int UserId { get; set; }
/// <summary>
///
/// </summary>
public int UserId { get; set; }
public int Status { get; set; }
/// <summary>
///
/// </summary>
public int Status { get; set; }
public string StatusName { get; set; }
/// <summary>
/// Default value is string.Empty
/// </summary>
public string StatusName { get; set; } = string.Empty;
public string Uuid { get; set; }
/// <summary>
/// Default value is string.Empty
/// </summary>
public string Uuid { get; set; } = string.Empty;
[TemplatePlaceholder("[MESSAGE]")]
public string Message { get; set; }
/// <summary>
/// Default value is string.Empty
/// </summary>
[TemplatePlaceholder("[MESSAGE]")]
public string Message { get; set; } = string.Empty;
public DateTime AddedWhen { get; set; }
/// <summary>
///
/// </summary>
public DateTime AddedWhen { get; set; }
public DateTime? ChangedWhen { get; set; }
/// <summary>
///
/// </summary>
public DateTime? ChangedWhen { get; set; }
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
public string Title { get; set; }
/// <summary>
/// Default value is string.Empty
/// </summary>
[TemplatePlaceholder("[DOCUMENT_TITLE]")]
public string Title { get; set; } = string.Empty;
public int? ContractType { get; set; }
/// <summary>
///
/// </summary>
public int? ContractType { get; set; }
public string Language { get; set; }
/// <summary>
/// Default value is 'de-DE'
/// </summary>
public string Language { get; set; } = "de-DE";
public int? EnvelopeTypeId { get; set; }
/// <summary>
///
/// </summary>
public int? EnvelopeTypeId { get; set; }
public int? CertificationType { get; set; }
/// <summary>
///
/// </summary>
public int? CertificationType { get; set; }
public bool? UseAccessCode { get; set; }
/// <summary>
///
/// </summary>
public bool? UseAccessCode { get; set; }
/// <summary>
///
/// </summary>
public bool TFAEnabled { get; init; }
public UserReadDto? User { get; set; }
/// <summary>
///
/// </summary>
public UserReadDto? User { get; set; }
public EnvelopeType? EnvelopeType { get; set; }
/// <summary>
///
/// </summary>
public EnvelopeType? EnvelopeType { get; set; }
public string? EnvelopeTypeTitle { get; set; }
/// <summary>
///
/// </summary>
public string? EnvelopeTypeTitle { get; set; }
public bool IsAlreadySent { get; set; }
/// <summary>
///
/// </summary>
public bool IsAlreadySent { get; set; }
/// <summary>
///
/// </summary>
public byte[]? DocResult { get; init; }
/// <summary>
///
/// </summary>
public IEnumerable<EnvelopeDocumentDto>? Documents { get; set; }
}

View File

@@ -1,14 +1,13 @@
using DigitalData.Core.Abstractions;
using DigitalData.UserManager.Application.DTOs.User;
using DigitalData.UserManager.Application.DTOs.User;
using EnvelopeGenerator.Application.DTOs.Receiver;
using static EnvelopeGenerator.CommonServices.Constants;
using static EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
/// <summary>
/// Data Transfer Object representing the history of an envelope, including status, sender, receiver, and related metadata.
/// </summary>
public record EnvelopeHistoryDto : IUnique<long>
public record EnvelopeHistoryDto
{
/// <summary>
/// Unique identifier for the envelope history entry.
@@ -23,7 +22,7 @@ public record EnvelopeHistoryDto : IUnique<long>
/// <summary>
/// Reference string for the user related to this history entry.
/// </summary>
public string UserReference { get; set; }
public required string UserReference { get; set; }
/// <summary>
/// Status code of the envelope at this history point.
@@ -66,8 +65,5 @@ public record EnvelopeHistoryDto : IUnique<long>
public string? Comment { get; set; }
/// <inheritdoc/>
public override int GetHashCode()
{
return Id.GetHashCode();
}
};
public override int GetHashCode() => Id.GetHashCode();
};

View File

@@ -1,33 +1,67 @@
using DigitalData.Core.Abstractions;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverBasicDto
{
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverBasicDto() : IUnique<(int Envelope, int Receiver)>
{
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
/// <summary>
///
/// </summary>
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
public int EnvelopeId { get; init; }
/// <summary>
///
/// </summary>
public int EnvelopeId { get; init; }
public int ReceiverId { get; init; }
/// <summary>
///
/// </summary>
public int ReceiverId { get; init; }
public int Sequence { get; init; }
/// <summary>
///
/// </summary>
public int Sequence { get; init; }
[TemplatePlaceholder("[NAME_RECEIVER]")]
public string? Name { get; init; }
/// <summary>
///
/// </summary>
[TemplatePlaceholder("[NAME_RECEIVER]")]
public string? Name { get; init; }
public string? JobTitle { get; init; }
/// <summary>
///
/// </summary>
public string? JobTitle { get; init; }
public string? CompanyName { get; init; }
/// <summary>
///
/// </summary>
public string? CompanyName { get; init; }
public string? PrivateMessage { get; init; }
/// <summary>
///
/// </summary>
public string? PrivateMessage { get; init; }
public DateTime AddedWhen { get; init; }
/// <summary>
///
/// </summary>
public DateTime AddedWhen { get; init; }
public DateTime? ChangedWhen { get; init; }
/// <summary>
///
/// </summary>
public DateTime? ChangedWhen { get; init; }
public bool HasPhoneNumber { get; init; }
}
/// <summary>
///
/// </summary>
public bool HasPhoneNumber { get; init; }
}

View File

@@ -1,13 +1,22 @@
using EnvelopeGenerator.Application.DTOs.Receiver;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
{
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
{
public EnvelopeDto? Envelope { get; set; }
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
public ReceiverReadDto? Receiver { get; set; }
}
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverDto() : EnvelopeReceiverBasicDto()
{
/// <summary>
///
/// </summary>
public EnvelopeDto? Envelope { get; set; }
/// <summary>
///
/// </summary>
public ReceiverReadDto? Receiver { get; set; }
}

View File

@@ -1,12 +1,20 @@
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver
{
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverSecretDto() : EnvelopeReceiverDto()
{
public string? AccessCode { get; init; }
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiver;
public string? PhoneNumber { get; init; }
}
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverSecretDto : EnvelopeReceiverDto
{
/// <summary>
///
/// </summary>
public string? AccessCode { get; init; }
/// <summary>
///
/// </summary>
public string? PhoneNumber { get; init; }
}

View File

@@ -2,23 +2,38 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
/// <summary>
///
/// </summary>
/// <param name="DateValid"></param>
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverReadOnlyCreateDto(
DateTime DateValid)
{
[ApiExplorerSettings(IgnoreApi = true)]
public record EnvelopeReceiverReadOnlyCreateDto(
DateTime DateValid)
{
[EmailAddress]
[Required]
public required string ReceiverMail { get; init; }
/// <summary>
///
/// </summary>
[EmailAddress]
[Required]
public required string ReceiverMail { get; init; }
[JsonIgnore]
public long? EnvelopeId { get; set; } = null;
/// <summary>
/// Default value is null
/// </summary>
[JsonIgnore]
public long? EnvelopeId { get; set; } = null;
[JsonIgnore]
public string? AddedWho { get; set; }
/// <summary>
///
/// </summary>
[JsonIgnore]
public string? AddedWho { get; set; }
[JsonIgnore]
public DateTime AddedWhen { get; } = DateTime.Now;
};
}
/// <summary>
/// Default value is DateTime.Now
/// </summary>
[JsonIgnore]
public DateTime AddedWhen { get; } = DateTime.Now;
};

View File

@@ -23,7 +23,7 @@ public class EnvelopeReceiverReadOnlyDto
/// <summary>
/// Gets or inits the email address of the receiver.
/// </summary>
public string ReceiverMail { get; set; }
public required string ReceiverMail { get; set; }
/// <summary>
/// Gets or inits the date until which the receiver is valid.
@@ -37,8 +37,9 @@ public class EnvelopeReceiverReadOnlyDto
/// <summary>
/// Gets or inits the user who added the receiver.
/// Default value is 'unknown'.
/// </summary>
public string AddedWho { get; init; }
public string AddedWho { get; init; } = "Unknown";
/// <summary>
/// Gets or inits the associated envelope details.

View File

@@ -1,5 +1,4 @@
using DigitalData.Core.Abstractions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
@@ -7,7 +6,7 @@ namespace EnvelopeGenerator.Application.DTOs.EnvelopeReceiverReadOnly;
/// Data Transfer Object for updating a read-only envelope receiver.
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class EnvelopeReceiverReadOnlyUpdateDto : IUnique<long>
public class EnvelopeReceiverReadOnlyUpdateDto
{
/// <summary>
/// Gets or sets the unique identifier of the envelope receiver.
@@ -21,8 +20,9 @@ public class EnvelopeReceiverReadOnlyUpdateDto : IUnique<long>
/// <summary>
/// Gets or sets the name of the user who made the change.
/// Default value is unknown.
/// </summary>
public string ChangedWho { get; set; }
public string ChangedWho { get; set; } = "Unknown";
/// <summary>
/// Gets or sets the date and time when the change was made.

View File

@@ -16,12 +16,12 @@ public class EnvelopeTypeDto
/// <summary>
/// Gets or sets the title of the envelope type.
/// </summary>
public string Title { get; set; }
public string Title { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the language code used in this envelope type.
/// </summary>
public string Language { get; set; }
public string Language { get; set; } = "de-DE";
/// <summary>
/// Gets or sets the number of days after which the envelope expires.

View File

@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.Messaging
{
[ApiExplorerSettings(IgnoreApi = true)]
public class GtxMessagingResponse : Dictionary<string, object?> { }
}
namespace EnvelopeGenerator.Application.DTOs.Messaging;
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class GtxMessagingResponse : Dictionary<string, object?> { }

View File

@@ -1,14 +1,25 @@
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.Application.DTOs.Messaging
namespace EnvelopeGenerator.Application.DTOs.Messaging;
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record SmsResponse
{
[ApiExplorerSettings(IgnoreApi = true)]
public record SmsResponse
{
public required bool Ok { get; init; }
/// <summary>
///
/// </summary>
public required bool Ok { get; init; }
public bool Failed => !Ok;
/// <summary>
/// Returns !Ok
/// </summary>
public bool Failed => !Ok;
public dynamic? Errors { get; init; }
}
/// <summary>
///
/// </summary>
public dynamic? Errors { get; init; }
}

View File

@@ -5,9 +5,15 @@ using System.Text;
namespace EnvelopeGenerator.Application.DTOs.Receiver;
/// <summary>
///
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public record ReceiverCreateDto
{
/// <summary>
///
/// </summary>
public ReceiverCreateDto()
{
_sha256HexOfMail = new(() =>
@@ -19,14 +25,29 @@ public record ReceiverCreateDto
});
}
/// <summary>
///
/// </summary>
[EmailAddress]
public required string EmailAddress { get; init; }
/// <summary>
///
/// </summary>
public string? TotpSecretkey { get; init; }
/// <summary>
/// var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());<br>
/// var hash_arr = SHA256.HashData(bytes_arr);
/// var hexa_str = BitConverter.ToString(hash_arr);
/// return hexa_str.Replace("-", string.Empty);
/// </summary>
public string Signature => _sha256HexOfMail.Value;
private readonly Lazy<string> _sha256HexOfMail;
/// <summary>
/// Default value is DateTime.Now
/// </summary>
public DateTime AddedWhen { get; } = DateTime.Now;
};