- Add Skill navigation properties to PhaseSection and ProjectSection, with EF Core mappings and migration for foreign keys and indexes. - Refactor SetSkillFlags in GetProjectsListQueryHandler for clarity and efficiency; use eager loading for Skill. - Add HasRemainingTime() to TaskSection and enforce time check in ChangeStatusSectionCommandHandler. - Optimize EmployeeDocumentsRepository queries; add EmployeeId to WorkshopWithEmployeeDocumentsViewModel. - Improve CustomExceptionHandler to handle FluentValidation exceptions and return proper status codes. - Add FluentValidation package reference and perform minor code cleanups.
26 lines
859 B
C#
26 lines
859 B
C#
using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
|
|
|
|
public class ProjectSectionMapping:IEntityTypeConfiguration<ProjectSection>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ProjectSection> builder)
|
|
{
|
|
builder.HasKey(x => x.Id);
|
|
builder.Property(x => x.Id)
|
|
.ValueGeneratedNever();
|
|
|
|
builder.HasOne(x => x.Project)
|
|
.WithMany(x => x.ProjectSections)
|
|
.HasForeignKey(x => x.ProjectId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasOne(x => x.Skill)
|
|
.WithMany()
|
|
.HasForeignKey(x => x.SkillId)
|
|
.IsRequired(false)
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
}
|
|
} |