using Domain.Entities.Paper; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Paper; public sealed class PaperAccountConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.Cascade); builder.HasIndex(x => x.MemberID).IsUnique(); builder.ToTable(nameof(PaperAccount), t => t.HasComment("모의투자 계좌 (회원당 1개)")); builder.HasKey(x => x.ID); builder.Property(x => x.ID).ValueGeneratedOnAdd().HasComment("PK"); builder.Property(x => x.MemberID).IsRequired().HasComment("회원 ID"); builder.Property(x => x.Token).HasPrecision(18, 0).IsRequired().HasComment("자유 현금 토큰"); builder.Property(x => x.ReservedToken).HasPrecision(18, 0).IsRequired().HasComment("매수 예약 토큰"); builder.Property(x => x.Units).HasPrecision(18, 8).IsRequired().HasComment("좌수"); builder.Property(x => x.TotalDeposited).HasPrecision(18, 0).IsRequired().HasComment("누적 입금"); builder.Property(x => x.TotalWithdrawn).HasPrecision(18, 0).IsRequired().HasComment("누적 출금"); builder.Property(x => x.CreatedAt).IsRequired(); builder.Property(x => x.RowVersion).IsRowVersion(); } }