using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using mws.backend.dotnet.domain.Tasks; namespace mws.backend.dotnet.infrastructure.Persistence.Configuration; public class TaskConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder e) { e.ToTable("tasks"); e.HasKey(t => t.Id); e.Property(t => t.Title).HasMaxLength(300).IsRequired(); e.Property(t => t.Description).HasColumnType("text"); e.Property(t => t.Status).HasConversion().HasMaxLength(20); e.Property(t => t.Priority).HasConversion().HasMaxLength(20); e.HasIndex(t => t.ProjectId); e.HasIndex(t => t.AssigneeId); e.HasIndex(t => t.Status); e.HasOne(t => t.Assignee) .WithMany() .HasForeignKey(t => t.AssigneeId) .OnDelete(DeleteBehavior.SetNull); } }