Files
pfm/PostFundManagement.Domain/Configuration/AuditLog.cs
T
hermes 109fa0602e Added entity-model mappers
Added and applied field size constants
2026-08-16 10:08:33 +02:00

25 lines
1.0 KiB
C#

using static PostFundManagement.Domain.Extensions.Constants;
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(LabelLength);
builder.Property(f => f.EntityId).IsRequired();
builder.Property(f => f.Action).IsRequired().HasMaxLength(ShortLabelLength);
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);
}
}