enhanced the get team based on project

This commit is contained in:
ashutosh.nehete 2025-10-10 12:36:11 +05:30
parent 522deae8f7
commit 000cef3bb7

View File

@ -2823,9 +2823,14 @@ namespace Marco.Pms.Services.Service
public async Task<List<ProjectAllocation>> GetTeamByProject(Guid TenantId, Guid ProjectId, Guid? OrganizationId, bool IncludeInactive) public async Task<List<ProjectAllocation>> GetTeamByProject(Guid TenantId, Guid ProjectId, Guid? OrganizationId, bool IncludeInactive)
{ {
var projectAllocationQuery = _context.ProjectAllocations var projectAllocationQuery = _context.ProjectAllocations
.Include(pa => pa.Project)
.Include(pa => pa.Employee) .Include(pa => pa.Employee)
.ThenInclude(e => e!.Organization) .ThenInclude(e => e!.Organization)
.Where(pa => pa.TenantId == TenantId && pa.ProjectId == ProjectId); .Include(pa => pa.Employee)
.ThenInclude(e => e!.JobRole)
.Where(pa => pa.TenantId == TenantId &&
pa.ProjectId == ProjectId && pa.Project != null &&
pa.Employee != null && pa.Employee.Organization != null && pa.Employee.JobRole != null);
if (!IncludeInactive) if (!IncludeInactive)
{ {
projectAllocationQuery = projectAllocationQuery.Where(pa => pa.IsActive); projectAllocationQuery = projectAllocationQuery.Where(pa => pa.IsActive);