Files
Backend-Api/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Mappings/PhaseSectionMapping.cs
mahan ef865d9c68 Add Skill navigation to Phase/ProjectSection, refactor logic
- 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.
2025-12-15 20:56:32 +03:30

27 lines
842 B
C#

using GozareshgirProgramManager.Domain.ProjectAgg.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace GozareshgirProgramManager.Infrastructure.Persistence.Mappings;
public class PhaseSectionMapping:IEntityTypeConfiguration<PhaseSection>
{
public void Configure(EntityTypeBuilder<PhaseSection> builder)
{
builder.HasKey(ps => ps.Id);
builder.Property(ps => ps.Id)
.ValueGeneratedOnAdd();
builder.HasOne(ps => ps.Phase)
.WithMany(p => p.PhaseSections)
.HasForeignKey(ps => ps.PhaseId)
.OnDelete(DeleteBehavior.Cascade);
builder.HasOne(ps => ps.Skill)
.WithMany()
.HasForeignKey(ps => ps.SkillId)
.IsRequired(false)
.OnDelete(DeleteBehavior.Restrict);
}
}