Added auditlog entity
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
namespace PostFundManagement.Domain.Configuration;
|
||||
|
||||
public sealed class AuditLog : IEntityTypeConfiguration<Entities.AuditLog>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Entities.AuditLog> builder)
|
||||
{
|
||||
builder.ToTable(nameof(Entities.AuditLog).Pluralize());
|
||||
|
||||
builder.HasKey(pk => pk.Id);
|
||||
builder.Property(f => f.EntityName).IsRequired().HasMaxLength(128);
|
||||
builder.Property(f => f.EntityId).IsRequired();
|
||||
builder.Property(f => f.Action).IsRequired().HasMaxLength(64);
|
||||
builder.Property(f => f.Changes).IsRequired(false).HasColumnType("jsonb");
|
||||
builder.Property(f => f.PerformedBy).IsRequired();
|
||||
builder.Property(f => f.Timestamp).IsRequired().HasDefaultValueSql("now()");
|
||||
|
||||
builder.HasOne(f => f.Performer)
|
||||
.WithMany()
|
||||
.HasForeignKey(fk => fk.PerformedBy)
|
||||
.IsRequired()
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace PostFundManagement.Domain.Entities;
|
||||
|
||||
[EntityTypeConfiguration<Configuration.AuditLog, AuditLog>]
|
||||
public class AuditLog : Models.AuditLog
|
||||
{
|
||||
public virtual User? Performer { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user