Changed CertificationType from int? to CertificationType? enum across multiple files, including EnvelopeDto, EnvelopeTypeDto, and CreateEnvelopeCommand, to improve type safety. Removed the NormalizeCertificationType method as it is no longer necessary. Updated components and records to use the enum directly, enhancing code clarity and reducing potential errors. Added necessary using directives for the enum.
142 lines
4.2 KiB
C#
142 lines
4.2 KiB
C#
using EnvelopeGenerator.Application.Common.Dto;
|
|
using EnvelopeGenerator.Application.Common.Interfaces.SQLExecutor;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using MediatR;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace EnvelopeGenerator.Application.Envelopes.Commands;
|
|
|
|
/// <summary>
|
|
/// Befehl zur Erstellung eines Umschlags.
|
|
/// </summary>
|
|
public record CreateEnvelopeCommand : IRequest<EnvelopeDto?>
|
|
{
|
|
/// <summary>
|
|
/// Optionale Umschlag-ID fuer Aktualisierungsvorgaenge.
|
|
/// </summary>
|
|
public int? EnvelopeId { get; init; }
|
|
|
|
/// <summary>
|
|
/// Kennung des ausgewaehlten Umschlagtyps (Vorlage).
|
|
/// </summary>
|
|
public int? EnvelopeTypeId { get; set; }
|
|
|
|
/// <summary>
|
|
/// Sprachcode fuer Umschlaginhalt und Benachrichtigungen.
|
|
/// </summary>
|
|
public string? Language { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt an, ob der Zugriffscode fuer Empfaenger aktiviert ist.
|
|
/// </summary>
|
|
public bool? UseAccessCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// Zertifizierungstyp fuer den Signaturprozess.
|
|
/// </summary>
|
|
public CertificationType? CertificationType { get; set; }
|
|
|
|
/// <summary>
|
|
/// Finale E-Mail-Einstellung fuer den Ersteller.
|
|
/// </summary>
|
|
public int? FinalEmailToCreator { get; set; }
|
|
|
|
/// <summary>
|
|
/// Finale E-Mail-Einstellung fuer die Empfaenger.
|
|
/// </summary>
|
|
public int? FinalEmailToReceivers { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt an, ob Erinnerungs-E-Mails aktiviert sind.
|
|
/// </summary>
|
|
public bool? SendReminderEmails { get; set; }
|
|
|
|
/// <summary>
|
|
/// Anzahl der Tage bis zur ersten Erinnerung.
|
|
/// </summary>
|
|
public int? FirstReminderDays { get; set; }
|
|
|
|
/// <summary>
|
|
/// Intervall in Tagen zwischen Erinnerungs-E-Mails.
|
|
/// </summary>
|
|
public int? ReminderIntervalDays { get; set; }
|
|
|
|
/// <summary>
|
|
/// Anzahl der Tage bis zum Ablauf des Umschlags.
|
|
/// </summary>
|
|
public int? ExpiresWhenDays { get; set; }
|
|
|
|
/// <summary>
|
|
/// Anzahl der Tage vor Ablauf, ab denen gewarnt wird.
|
|
/// </summary>
|
|
public int? ExpiresWarningWhenDays { get; set; }
|
|
|
|
/// <summary>
|
|
/// Der Titel des Umschlags. Dies ist ein Pflichtfeld.
|
|
/// </summary>
|
|
public string? Title { get; set; }
|
|
|
|
/// <summary>
|
|
/// Die Nachricht, die im Umschlag enthalten sein soll. Dies ist ein Pflichtfeld.
|
|
/// </summary>
|
|
public string? Message { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gibt an, ob die Zwei-Faktor-Authentifizierung für den Umschlag aktiviert ist. Standardmäßig false.
|
|
/// </summary>
|
|
public bool TFAEnabled { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Gibt an, ob der Umschlag nach dem Speichern sofort versendet werden soll.
|
|
/// </summary>
|
|
public bool Send { get; init; }
|
|
|
|
/// <summary>
|
|
/// Optionaler PDF-Dokumentinhalt als Base64.
|
|
/// </summary>
|
|
public CreateEnvelopeDocumentDto? Document { get; init; }
|
|
|
|
/// <summary>
|
|
/// Empfaengerliste inklusive optionaler Signaturfeld-Koordinaten.
|
|
/// </summary>
|
|
public List<CreateEnvelopeReceiverDto> Receivers { get; init; } = new();
|
|
|
|
/// <summary>
|
|
/// ID des Absenders
|
|
/// </summary>
|
|
internal int UserId { get; private set; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
/// <returns></returns>
|
|
public CreateEnvelopeCommand WithAuth(int userId)
|
|
{
|
|
UserId = userId;
|
|
return this;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Determines which component is used for envelope processing.
|
|
/// When <c>true</c>, processing is delegated to <see cref="IEnvelopeExecutor"/>;
|
|
/// when <c>false</c>, <see cref="IRepository{Envelope}"/> is used instead.
|
|
/// Note: <see cref="IRepository{Envelope}"/> should only be used in testing scenarios.
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
[NotMapped]
|
|
public bool UseSQLExecutor { get; set; } = true;
|
|
}
|
|
|
|
public record CreateEnvelopeDocumentDto(string DataAsBase64);
|
|
|
|
public record CreateEnvelopeFieldDto(double X, double Y, int Page);
|
|
|
|
public record CreateEnvelopeReceiverDto(
|
|
string EmailAddress,
|
|
string? Name,
|
|
string? PhoneNumber,
|
|
List<CreateEnvelopeFieldDto> Fields);
|