using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Nuuru.Server.Models; namespace Nuuru.Server.Data.EntityConfigurations { public class ReactionConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { // Unique constraint: one user can only react with a specific emote once per entity builder.HasIndex(r => new { r.EntityType, r.EntityId, r.UserId, r.EmoteName }) .IsUnique(); // Index for fetching reactions by entity builder.HasIndex(r => new { r.EntityType, r.EntityId }); // Index for grouped reaction summaries by emote builder.HasIndex(r => new { r.EntityType, r.EntityId, r.EmoteName }); // Index for user's reactions builder.HasIndex(r => r.UserId); } } }