Init
This commit is contained in:
39
Prefab/Data/Entities/AuditLog.cs
Normal file
39
Prefab/Data/Entities/AuditLog.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Prefab.Domain.Common;
|
||||
|
||||
namespace Prefab.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an audit log entry that captures an entity state transition.
|
||||
/// </summary>
|
||||
public class AuditLog : Entity<int>, ICreated
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the correlation identifier tying related audit events together.
|
||||
/// </summary>
|
||||
public Guid CorrelationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fully qualified entity name that generated the audit record.
|
||||
/// </summary>
|
||||
public string Entity { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the serialized state of the entity when the audit was captured.
|
||||
/// </summary>
|
||||
public string State { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of field-level changes associated with the audit.
|
||||
/// </summary>
|
||||
public virtual ICollection<AuditLogItem> Items { get; set; } = new List<AuditLogItem>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the identifier of the user who triggered the change.
|
||||
/// </summary>
|
||||
public Guid CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp when the change occurred.
|
||||
/// </summary>
|
||||
public DateTimeOffset CreatedOn { get; set; }
|
||||
}
|
||||
34
Prefab/Data/Entities/AuditLogItem.cs
Normal file
34
Prefab/Data/Entities/AuditLogItem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Prefab.Domain.Common;
|
||||
|
||||
namespace Prefab.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a field-level change within an audit log entry.
|
||||
/// </summary>
|
||||
public class AuditLogItem : Entity<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the parent audit log identifier.
|
||||
/// </summary>
|
||||
public int AuditLogId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the property name that changed.
|
||||
/// </summary>
|
||||
public string Property { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the previous serialized value.
|
||||
/// </summary>
|
||||
public string? OldValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the new serialized value.
|
||||
/// </summary>
|
||||
public string? NewValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the navigation back to the owning audit log.
|
||||
/// </summary>
|
||||
public virtual AuditLog AuditLog { get; set; } = null!;
|
||||
}
|
||||
34
Prefab/Data/Entities/GenericAttribute.cs
Normal file
34
Prefab/Data/Entities/GenericAttribute.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Prefab.Domain.Common;
|
||||
|
||||
namespace Prefab.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a persisted generic attribute for an entity.
|
||||
/// </summary>
|
||||
public class GenericAttribute : EntityWithAuditAndStatus<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the owning entity identifier.
|
||||
/// </summary>
|
||||
public Guid EntityId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the logical group used to partition attributes by entity type.
|
||||
/// </summary>
|
||||
public string KeyGroup { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the attribute key.
|
||||
/// </summary>
|
||||
public string Key { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the fully qualified type name of the serialized value.
|
||||
/// </summary>
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the serialized attribute value.
|
||||
/// </summary>
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
24
Prefab/Data/Entities/SeederLog.cs
Normal file
24
Prefab/Data/Entities/SeederLog.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Prefab.Domain.Common;
|
||||
|
||||
namespace Prefab.Data.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Captures metadata about seeder executions to prevent duplicate runs.
|
||||
/// </summary>
|
||||
public class SeederLog : Entity<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the seeder identifier.
|
||||
/// </summary>
|
||||
public string SeederName { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the run mode (e.g., Development or Production) used for the execution.
|
||||
/// </summary>
|
||||
public string RunMode { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timestamp when the seeder completed.
|
||||
/// </summary>
|
||||
public DateTime RunAt { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user