ApiRateLimitConfiguration.cs 846 B

1234567891011121314151617181920
  1. using Domain.Entities.Developers;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Developers;
  5. public class ApiRateLimitConfiguration : IEntityTypeConfiguration<ApiRateLimit>
  6. {
  7. public void Configure(EntityTypeBuilder<ApiRateLimit> builder)
  8. {
  9. builder.HasOne(x => x.Application).WithMany().HasForeignKey(x => x.ApplicationID).OnDelete(DeleteBehavior.Cascade);
  10. builder.HasIndex(x => x.ApplicationID).IsUnique();
  11. builder.ToTable(nameof(ApiRateLimit), x => x.HasComment("앱별 Rate Limit override"));
  12. builder.HasKey(x => x.ID);
  13. builder.Property(x => x.LimitPerMinute).IsRequired();
  14. builder.Property(x => x.CreatedAt).IsRequired();
  15. builder.Property(x => x.UpdatedAt).IsRequired();
  16. }
  17. }