DonationAlertConfigConfiguration.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Domain.Entities.Donations;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Donations;
  5. public class DonationAlertConfigConfiguration : IEntityTypeConfiguration<DonationAlertConfig>
  6. {
  7. public void Configure(EntityTypeBuilder<DonationAlertConfig> builder)
  8. {
  9. builder.ToTable(nameof(DonationAlertConfig), x => x.HasComment("후원 알림 위젯 설정"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasOne(x => x.Channel).WithMany().HasForeignKey(x => x.ChannelID).OnDelete(DeleteBehavior.Cascade);
  12. builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.NoAction);
  13. builder.HasIndex(x => new { x.ChannelID, x.MemberID, x.Amount });
  14. builder.HasIndex(x => new { x.ChannelID, x.IsActive });
  15. builder.HasIndex(x => new { x.ChannelID, x.MatchType, x.Amount });
  16. builder.Property(x => x.Title).HasMaxLength(200).IsRequired();
  17. builder.Property(x => x.Message).HasMaxLength(200).IsRequired();
  18. builder.Property(x => x.PopupEffect).HasMaxLength(50);
  19. builder.Property(x => x.TextEffect).HasMaxLength(50);
  20. builder.Property(x => x.NicknameFontFamily).HasMaxLength(100);
  21. builder.Property(x => x.NicknameFontColor).HasMaxLength(20).IsRequired();
  22. builder.Property(x => x.AmountFontFamily).HasMaxLength(100);
  23. builder.Property(x => x.AmountFontColor).HasMaxLength(20).IsRequired();
  24. builder.Property(x => x.MessageFontFamily).HasMaxLength(100);
  25. builder.Property(x => x.MessageFontColor).HasMaxLength(20).IsRequired();
  26. builder.Property(x => x.ImageUrl).HasMaxLength(500);
  27. builder.Property(x => x.SoundUrl).HasMaxLength(500);
  28. }
  29. }