using Heimdall.Domain.Entities; using Heimdall.Domain.Enums; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Heimdall.Infrastructure.Data.Configurations; public class NotificationConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("notifications"); builder.HasKey(n => n.Id); builder.Property(n => n.Title) .HasMaxLength(200) .IsRequired(); builder.Property(n => n.Message) .HasMaxLength(2000) .IsRequired(); builder.Property(n => n.Type) .HasConversion() .HasMaxLength(50); builder.Property(n => n.EventType) .HasConversion() .HasMaxLength(50); builder.Property(n => n.SnapshotUrl) .HasMaxLength(500); builder.Property(n => n.Link) .HasMaxLength(500); builder.Property(n => n.CreatedAt) .HasDefaultValueSql("NOW()"); builder.Property(n => n.UpdatedAt) .HasDefaultValueSql("NOW()"); // Indexes builder.HasIndex(n => n.UserId); builder.HasIndex(n => new { n.UserId, n.IsRead }); builder.HasIndex(n => n.CreatedAt); } }