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.
This commit is contained in:
@@ -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)]
|
||||
@@ -26,86 +25,86 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
|
||||
[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 DigitalData.UserManager.Domain.Entities.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 IEnumerable<EnvelopeDocument>? Documents { get; set; }
|
||||
public IEnumerable<EnvelopeDocument> Documents { get; set; }
|
||||
|
||||
public IEnumerable<EnvelopeHistory>? History { get; set; }
|
||||
public IEnumerable<EnvelopeHistory> History { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user