22 lines
761 B
C#
22 lines
761 B
C#
using Microsoft.EntityFrameworkCore;
|
|||
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||
|
|
using mws.backend.dotnet.domain.Audit;
|
||
|
|
|
||
|
|
namespace mws.backend.dotnet.infrastructure.Persistence.Configuration;
|
||
|
|
|
||
|
|
public class LoginLogConfiguration : IEntityTypeConfiguration<LoginLog>
|
||
|
|
{
|
||
|
|
public void Configure(EntityTypeBuilder<LoginLog> e)
|
||
|
|
{
|
||
|
|
e.ToTable("login_logs");
|
||
|
|
e.HasKey(x => x.Id);
|
||
|
|
e.Property(x => x.Username).HasMaxLength(100).IsRequired();
|
||
|
|
e.Property(x => x.FailureReason).HasMaxLength(100);
|
||
|
|
e.Property(x => x.IpAddress).HasMaxLength(45);
|
||
|
|
e.Property(x => x.UserAgent).HasMaxLength(512);
|
||
|
|
e.HasIndex(x => x.CreatedAt);
|
||
|
|
e.HasIndex(x => x.Username);
|
||
|
|
e.HasIndex(x => x.Success);
|
||
|
|
}
|
||
|
|
}
|