diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeTaskPriority/ChangeTaskPriorityCommand.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeTaskPriority/ChangeTaskPriorityCommand.cs
new file mode 100644
index 00000000..23d23830
--- /dev/null
+++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Commands/ChangeTaskPriority/ChangeTaskPriorityCommand.cs
@@ -0,0 +1,41 @@
+using GozareshgirProgramManager.Application._Common.Interfaces;
+using GozareshgirProgramManager.Application._Common.Models;
+using GozareshgirProgramManager.Domain._Common;
+using GozareshgirProgramManager.Domain.ProjectAgg.Enums;
+using GozareshgirProgramManager.Domain.ProjectAgg.Repositories;
+
+namespace GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeTaskPriority;
+
+///
+/// Command to change a task priority.
+///
+public record ChangeTaskPriorityCommand(Guid TaskId, TaskPriority Priority) : IBaseCommand;
+
+public class ChangeTaskPriorityCommandHandler : IBaseCommandHandler
+{
+ private readonly IProjectTaskRepository _taskRepository;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public ChangeTaskPriorityCommandHandler(IProjectTaskRepository taskRepository, IUnitOfWork unitOfWork)
+ {
+ _taskRepository = taskRepository;
+ _unitOfWork = unitOfWork;
+ }
+
+ public async Task Handle(ChangeTaskPriorityCommand request, CancellationToken cancellationToken)
+ {
+ var task = await _taskRepository.GetByIdAsync(request.TaskId, cancellationToken);
+ if (task is null)
+ return OperationResult.NotFound("تسک یافت نشد");
+
+ // Idempotent: if already same priority, skip extra work
+ if (task.Priority != request.Priority)
+ {
+ task.SetPriority(request.Priority);
+ }
+
+ await _unitOfWork.SaveChangesAsync(cancellationToken);
+ return OperationResult.Success();
+ }
+}
+
diff --git a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/GetProjectsList/GetProjectsListQueryHandler.cs b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/GetProjectsList/GetProjectsListQueryHandler.cs
index d26a06b1..a982caf3 100644
--- a/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/GetProjectsList/GetProjectsListQueryHandler.cs
+++ b/ProgramManager/src/Application/GozareshgirProgramManager.Application/Modules/Projects/Queries/GetProjectsList/GetProjectsListQueryHandler.cs
@@ -189,6 +189,7 @@ public class GetProjectsListQueryHandler : IBaseQueryHandler Sections { get; init; }
}
diff --git a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Repositories/TaskSectionRepository.cs b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Repositories/TaskSectionRepository.cs
index 1b29e154..d6d60b69 100644
--- a/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Repositories/TaskSectionRepository.cs
+++ b/ProgramManager/src/Infrastructure/GozareshgirProgramManager.Infrastructure/Persistence/Repositories/TaskSectionRepository.cs
@@ -19,6 +19,7 @@ public class TaskSectionRepository:RepositoryBase,ITaskSection
{
return await _context.TaskSections
.Include(x => x.Activities)
+ .Include(x=>x.AdditionalTimes)
.FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
}
diff --git a/ServiceHost/Areas/Admin/Controllers/ProgramManager/ProjectController.cs b/ServiceHost/Areas/Admin/Controllers/ProgramManager/ProjectController.cs
index 5325c8ab..a83b398c 100644
--- a/ServiceHost/Areas/Admin/Controllers/ProgramManager/ProjectController.cs
+++ b/ServiceHost/Areas/Admin/Controllers/ProgramManager/ProjectController.cs
@@ -22,6 +22,7 @@ using GozareshgirProgramManager.Application.Modules.Projects.Queries.GetProjectH
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ServiceHost.BaseControllers;
+using GozareshgirProgramManager.Application.Modules.Projects.Commands.ChangeTaskPriority;
namespace ServiceHost.Areas.Admin.Controllers.ProgramManager;