diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQuery.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQuery.cs index 73ea9a9e..d550cdbe 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQuery.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQuery.cs @@ -7,5 +7,6 @@ namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.Project public record ProjectBoardListQuery: IBaseQuery> { public long? UserId { get; set; } + public string? SearchText { get; set; } public TaskSectionStatus? Status { get; set; } } \ No newline at end of file diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQueryHandler.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQueryHandler.cs index 4ff4f377..a5b171f4 100644 --- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQueryHandler.cs +++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/ProjectBoardList/ProjectBoardListQueryHandler.cs @@ -3,7 +3,6 @@ using GozareshgirProgramManager.Application._Common.Interfaces; using GozareshgirProgramManager.Application._Common.Models; using GozareshgirProgramManager.Domain.ProjectAgg.Enums; using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Query.Internal; namespace GozareshgirProgramManager.Application.Modules.Projects.Queries.ProjectBoardList; @@ -24,7 +23,8 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler x.InitialEstimatedHours > TimeSpan.Zero && x.Status != TaskSectionStatus.Completed) + .Where(x => x.InitialEstimatedHours > TimeSpan.Zero + && x.Status != TaskSectionStatus.Completed) .Include(x => x.Task) .ThenInclude(x => x.Phase) .ThenInclude(x => x.Project) @@ -45,10 +45,18 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler x.CurrentAssignedUserId == request.UserId); } + + if (!string.IsNullOrWhiteSpace(request.SearchText)) + { + queryable = queryable.Where(x=>x.Task.Name.Contains(request.SearchText) + || x.Task.Phase.Name.Contains(request.SearchText) + || x.Task.Phase.Project.Name.Contains(request.SearchText)); + } var data = await queryable.ToListAsync(cancellationToken); - var activityUserIds = data.SelectMany(x => x.Activities).Select(a => a.UserId).Distinct().ToList(); + var activityUserIds = data.SelectMany(x => x.Activities) + .Select(a => a.UserId).Distinct().ToList(); var assignedUser = data.Select(x => x.CurrentAssignedUserId) .Concat(data.Select(x => x.OriginalAssignedUserId)).ToList(); var allUserIds = activityUserIds.Concat(assignedUser).Distinct().ToList(); @@ -72,7 +80,7 @@ public class ProjectBoardListQueryHandler : IBaseQueryHandler