Add audit interfaces and fields to domain entities

Introduced interfaces for audit fields (AddedWhen, ChangedWhen, ChangedWho, AddedWho) and updated domain entities to implement them. Adjusted properties for consistency and nullability. Updated MappingProfile to map audit fields between DTOs and entities. Improves auditability and standardization across the domain model.
This commit is contained in:
2026-02-09 15:11:42 +01:00
parent 0fb94decdd
commit e2afbc5a62
15 changed files with 128 additions and 78 deletions

View File

@@ -1,9 +1,9 @@
using EnvelopeGenerator.Domain.Interfaces;
using System;
using EnvelopeGenerator.Domain.Interfaces;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
#endif
@@ -11,11 +11,11 @@ namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{
{
#endif
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
public class Signature : ISignature, IHasReceiver
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho
{
public Signature()
{
@@ -92,14 +92,14 @@ public class Signature : ISignature, IHasReceiver
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]
public DateTime? AddedWhen { get; set; }
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[Column("CHANGED_WHO", TypeName = "nvarchar(100)")]
public string
#if NET
#if nullable
?
#endif
ChangedWho { get; set; }
@@ -109,13 +109,13 @@ public class Signature : ISignature, IHasReceiver
[ForeignKey("ReceiverId")]
public virtual Receiver
#if NET
#if nullable
?
#endif
Receiver { get; set; }
public virtual IEnumerable<ElementAnnotation>
#if NET
#if nullable
?
#endif
Annotations { get; set; }