WorldIndexSnapshotConfiguration.cs 1.8 KB

1234567891011121314151617181920212223242526272829
  1. using Domain.Entities.Stocks;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Stocks;
  5. public sealed class WorldIndexSnapshotConfiguration : IEntityTypeConfiguration<WorldIndexSnapshot>
  6. {
  7. public void Configure(EntityTypeBuilder<WorldIndexSnapshot> builder)
  8. {
  9. builder.ToTable(nameof(WorldIndexSnapshot), t => t.HasComment("세계 주요국 증시지수 최신 스냅샷 (메인 세계지도 핀, 외부 소스 일1회 upsert)"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasIndex(x => x.Symbol).IsUnique();
  12. builder.HasIndex(x => x.CountryCode);
  13. builder.Property(x => x.Symbol).HasMaxLength(20).IsRequired().HasComment("외부 소스(Stooq) 심볼");
  14. builder.Property(x => x.Name).HasMaxLength(100).IsRequired().HasComment("지수 표시명");
  15. builder.Property(x => x.CountryCode).HasMaxLength(2).IsRequired().HasComment("국가 코드 (ISO2)");
  16. builder.Property(x => x.ExchangeName).HasMaxLength(100).IsRequired().HasComment("거래소·시장 표기");
  17. builder.Property(x => x.Close).HasPrecision(18, 2).HasComment("종가");
  18. builder.Property(x => x.PrevClose).HasPrecision(18, 2).HasComment("직전 거래일 종가");
  19. builder.Property(x => x.ChangeVal).HasPrecision(18, 2).HasComment("전일 대비");
  20. builder.Property(x => x.FlucRateBp).HasComment("등락률 basis point (%×100)");
  21. builder.Property(x => x.Open).HasPrecision(18, 2).HasComment("시가");
  22. builder.Property(x => x.High).HasPrecision(18, 2).HasComment("고가");
  23. builder.Property(x => x.Low).HasPrecision(18, 2).HasComment("저가");
  24. builder.Property(x => x.Spark).HasMaxLength(1000).HasComment("최근 종가 스파크라인 (JSON decimal[], 과거→최신)");
  25. }
  26. }