Refactor EnvelopeType handling and improve validation

Removed AutoMapper dependency in `ReadEnvelopeTypesQueryHandler` and replaced it with manual projection to address null-materialization issues. Updated `EnvelopeType` entity properties to nullable types to align with the database schema. Adjusted computed properties to handle null values gracefully.

Enhanced `SenderEditorPage` with authentication checks, improved handling of reminder and expiry settings, and added validation for user input. Introduced `NormalizeSettings` and `ValidateSettings` methods to ensure consistent and valid configurations. Refactored checkbox value parsing for better reliability.

Injected `AuthService` and `IStringLocalizer` for authentication and localization support. Improved error messaging and localized validation errors. Performed minor code cleanup and refactoring for better readability and maintainability.
This commit is contained in:
2026-10-02 01:25:43 +02:00
parent 1e8e5c96c4
commit c7bc9fbcca
3 changed files with 121 additions and 28 deletions

View File

@@ -22,41 +22,41 @@ namespace EnvelopeGenerator.Domain.Entities
public string Language { get; set; }
[Column("EXPIRES_DAYS")]
public int ExpiresDays { get; set; }
public int? ExpiresDays { get; set; }
[Column("CERTIFICATION_TYPE")]
public Constants.CertificationType CertificationType { get; set; } = Constants.CertificationType.AdvancedElectronicSignature;
public Constants.CertificationType? CertificationType { get; set; }
[Column("USE_ACCESS_CODE")]
public bool UseAccessCode { get; set; }
public bool? UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public Constants.FinalEmailType FinalEmailToCreator { get; set; }
public Constants.FinalEmailType? FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public Constants.FinalEmailType FinalEmailToReceivers { get; set; }
public Constants.FinalEmailType? 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; } = false;
public bool? SendReminderEmails { get; set; }
[Column("FIRST_REMINDER_DAYS")]
public int FirstReminderDays { get; set; } = 0;
public int? FirstReminderDays { get; set; }
[Column("REMINDER_INTERVAL_DAYS")]
public int ReminderIntervalDays { get; set; } = 0;
public int? ReminderIntervalDays { get; set; }
[Column("CONTRACT_TYPE")]
public int ContractType { get; set; }
public int? ContractType { get; set; }
[NotMapped]
public bool TFA_Enabled { get; set; } = false;
@@ -70,14 +70,14 @@ namespace EnvelopeGenerator.Domain.Entities
[NotMapped]
public int ExpiresWhenDays
{
get => ExpiresDays;
get => ExpiresDays ?? 0;
set => ExpiresDays = value;
}
[NotMapped]
public int ExpiresWarningWhenDays
{
get => ExpiresWarningDays;
get => ExpiresWarningDays ?? 0;
set => ExpiresWarningDays = value;
}
@@ -86,4 +86,4 @@ namespace EnvelopeGenerator.Domain.Entities
return Title;
}
}
}
}