ApiRequestLogConfiguration.cs 888 B

12345678910111213141516171819202122
  1. using Domain.Entities.Developers;
  2. using Microsoft.EntityFrameworkCore;
  3. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  4. namespace Infrastructure.Persistence.Configurations.Developers;
  5. public class ApiRequestLogConfiguration : IEntityTypeConfiguration<ApiRequestLog>
  6. {
  7. public void Configure(EntityTypeBuilder<ApiRequestLog> builder)
  8. {
  9. builder.HasIndex(x => x.RequestedAt);
  10. builder.HasIndex(x => x.ApplicationID);
  11. builder.HasIndex(x => x.PatID);
  12. builder.ToTable(nameof(ApiRequestLog), x => x.HasComment("공개 API 호출 로그"));
  13. builder.HasKey(x => x.ID);
  14. builder.Property(x => x.Endpoint).HasMaxLength(200).IsRequired();
  15. builder.Property(x => x.Method).HasMaxLength(10).IsRequired();
  16. builder.Property(x => x.IpAddress).HasMaxLength(45);
  17. builder.Property(x => x.RequestedAt).IsRequired();
  18. }
  19. }