feat: add Logs
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using mws.backend.dotnet.domain.Audit;
|
||||
|
||||
namespace mws.backend.dotnet.infrastructure.Persistence.Configuration;
|
||||
|
||||
public class ActionLogConfiguration : IEntityTypeConfiguration<ActionLog>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ActionLog> e)
|
||||
{
|
||||
e.ToTable("action_logs");
|
||||
e.HasKey(x => x.Id);
|
||||
e.Property(x => x.ActorUsername).HasMaxLength(100).IsRequired();
|
||||
e.Property(x => x.Action).HasMaxLength(100).IsRequired();
|
||||
e.Property(x => x.EntityType).HasMaxLength(50).IsRequired();
|
||||
e.Property(x => x.EntityName).HasMaxLength(255);
|
||||
e.Property(x => x.IpAddress).HasMaxLength(45);
|
||||
e.Property(x => x.UserAgent).HasMaxLength(512);
|
||||
e.HasIndex(x => x.CreatedAt);
|
||||
e.HasIndex(x => x.ActorUserId);
|
||||
e.HasIndex(x => x.Action);
|
||||
e.HasIndex(x => x.EntityType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user