using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using SPMS.Domain.Entities; namespace SPMS.Infrastructure.Persistence.Configurations; public class WebhookLogConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("WebhookLog"); builder.HasKey(e => e.Id); builder.Property(e => e.Id).ValueGeneratedOnAdd(); builder.Property(e => e.ServiceId).IsRequired(); builder.Property(e => e.WebhookUrl).HasMaxLength(500).IsRequired(); builder.Property(e => e.EventType).HasColumnType("tinyint").IsRequired(); builder.Property(e => e.Payload).HasColumnType("json").IsRequired(); builder.Property(e => e.Status).HasColumnType("tinyint").IsRequired(); builder.Property(e => e.ResponseCode); builder.Property(e => e.ResponseBody).HasColumnType("text"); builder.Property(e => e.SentAt).IsRequired(); builder.HasOne(e => e.Service) .WithMany() .HasForeignKey(e => e.ServiceId) .OnDelete(DeleteBehavior.Restrict); builder.HasIndex(e => new { e.ServiceId, e.SentAt }); } }