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.
This commit is contained in:
2025-12-15 20:56:32 +03:30
parent cd64e1d24d
commit ef865d9c68
14 changed files with 1137 additions and 171 deletions

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
@@ -22,6 +23,7 @@ public class PhaseSection : EntityBase<Guid>
// Navigation property
public ProjectPhase Phase { get; private set; } = null!;
public Skill? Skill { get; set; }
public void UpdateUser(long userId)
{

View File

@@ -1,4 +1,5 @@
using GozareshgirProgramManager.Domain._Common;
using GozareshgirProgramManager.Domain.SkillAgg.Entities;
namespace GozareshgirProgramManager.Domain.ProjectAgg.Entities;
@@ -21,6 +22,7 @@ public class ProjectSection : EntityBase<Guid>
public Guid SkillId { get; private set; }
public Project Project { get; private set; } = null!;
public Skill? Skill { get; set; }
public void UpdateUser(long userId)
{

View File

@@ -210,4 +210,11 @@ public class TaskSection : EntityBase<Guid>
{
_additionalTimes.Clear();
}
public bool HasRemainingTime()
{
var totalSpent = GetTotalTimeSpent();
var finalEstimate = FinalEstimatedHours;
return totalSpent < finalEstimate;
}
}