using Domain.Entities.EmailVerification; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.EmailVerification; public sealed class EmailVerifyTokenConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasIndex(x => x.Type); builder.HasIndex(x => x.Email); builder.HasIndex(x => x.Token); builder.HasIndex(x => x.IsVerified); builder.HasIndex(x => x.Expiration); builder.HasIndex(x => new { x.Type, x.Email, x.Token }); builder.HasIndex(x => new { x.Type, x.Email, x.Token, x.IsVerified }); builder.ToTable(nameof(EmailVerifyToken), x => x.HasComment("이메일 인증 토큰들")); builder.HasKey(x => x.ID); builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK"); builder.Property(x => x.Type).HasConversion().IsRequired().HasComment("인증 유형 (이메일 인증 / 비밀번호 재설정)"); builder.Property(x => x.Email).HasMaxLength(60).IsRequired().HasComment("이메일"); builder.Property(x => x.Token).HasMaxLength(256).IsRequired().HasComment("Token"); builder.Property(x => x.IsVerified).IsRequired().HasComment("인증 여부"); builder.Property(x => x.Expiration).IsRequired().HasComment("만료 일시"); builder.Property(x => x.Additional).HasComment("추가 정보(JSON)"); builder.Property(x => x.CreatedAt).IsRequired().HasComment("등록 일시"); builder.Ignore(x => x.AdditionalData); } }