WithdrawalRequestConfiguration.cs 1.2 KB

123456789101112131415161718192021222324252627
  1. using Domain.Entities.Donations;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Donations;
  5. public class WithdrawalRequestConfiguration : IEntityTypeConfiguration<WithdrawalRequest>
  6. {
  7. public void Configure(EntityTypeBuilder<WithdrawalRequest> builder)
  8. {
  9. builder.ToTable(nameof(WithdrawalRequest), x => x.HasComment("출금 요청"));
  10. builder.HasKey(x => x.ID);
  11. builder.HasOne(x => x.Channel).WithMany().HasForeignKey(x => x.ChannelID).OnDelete(DeleteBehavior.NoAction);
  12. builder.HasOne(x => x.Member).WithMany().HasForeignKey(x => x.MemberID).OnDelete(DeleteBehavior.NoAction);
  13. builder.HasIndex(x => new { x.MemberID, x.RequestedAt });
  14. builder.HasIndex(x => new { x.MemberID, x.Status });
  15. builder.Property(x => x.BankCode).HasMaxLength(10);
  16. builder.Property(x => x.BankName).HasMaxLength(50);
  17. builder.Property(x => x.AccountNumber).HasMaxLength(500);
  18. builder.Property(x => x.AccountHolder).HasMaxLength(100);
  19. builder.Property(x => x.RejectedReason).HasMaxLength(500);
  20. builder.Property(x => x.AdminMemo).HasMaxLength(500);
  21. }
  22. }