ref: project structure
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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<TaskItem>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<TaskItem> 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<string>().HasMaxLength(20);
|
||||
e.Property(t => t.Priority).HasConversion<string>().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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user