AdminLoginLogConfiguration.cs 1.2 KB

123456789101112131415161718192021222324
  1. using Domain.Entities.Director;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Director;
  5. public sealed class AdminLoginLogConfiguration : IEntityTypeConfiguration<AdminLoginLog>
  6. {
  7. public void Configure(EntityTypeBuilder<AdminLoginLog> builder)
  8. {
  9. builder.HasIndex(x => x.Account);
  10. builder.HasIndex(x => x.CreatedAt);
  11. builder.ToTable(nameof(AdminLoginLog), x => x.HasComment("관리자 로그인 기록"));
  12. builder.HasKey(x => x.ID);
  13. builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK");
  14. builder.Property(x => x.Success).IsRequired().HasComment("로그인 성공 여부");
  15. builder.Property(x => x.Account).HasMaxLength(120).IsRequired().HasComment("로그인 시도 계정");
  16. builder.Property(x => x.Reason).HasMaxLength(225).HasComment("실패 사유");
  17. builder.Property(x => x.IpAddress).HasMaxLength(45).HasComment("IP 주소");
  18. builder.Property(x => x.UserAgent).HasMaxLength(512).HasComment("User Agent");
  19. builder.Property(x => x.CreatedAt).IsRequired().HasComment("생성 일시");
  20. }
  21. }