using Domain.Entities.Stocks; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Infrastructure.Persistence.Configurations.Stocks; public sealed class ExchangeRateConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable(nameof(ExchangeRate), t => t.HasComment("일별 환율 (한국수출입은행 OpenAPI AP01 현재환율)")); builder.HasKey(x => x.ID); builder.HasIndex(x => new { x.CurrencyUnit, x.TradeDate }).IsUnique(); builder.HasIndex(x => x.TradeDate); builder.Property(x => x.CurrencyUnit).HasMaxLength(20).IsRequired().HasComment("통화 코드 (cur_unit) — 예: USD, JPY(100)"); builder.Property(x => x.CurrencyName).HasMaxLength(100).IsRequired().HasComment("통화명 (cur_nm)"); builder.Property(x => x.DealBasRate).HasPrecision(10, 2).HasComment("매매기준율 (deal_bas_r)"); builder.Property(x => x.Ttb).HasPrecision(10, 2).HasComment("전신환 받으실 때 (ttb)"); builder.Property(x => x.Tts).HasPrecision(10, 2).HasComment("전신환 보내실 때 (tts)"); } }