瀏覽代碼

userTaskHistory

zinab_elgendy 5 月之前
父節點
當前提交
b55cbaa274
共有 27 個文件被更改,包括 3698 次插入50 次删除
  1. 1 1
      MTWorkHR.API/Controllers/CompanyController.cs
  2. 2 2
      MTWorkHR.API/Controllers/MeetingController.cs
  3. 1 1
      MTWorkHR.API/Controllers/ProjectController.cs
  4. 3 3
      MTWorkHR.API/Controllers/TeamController.cs
  5. 1 1
      MTWorkHR.API/Controllers/UserController.cs
  6. 3 2
      MTWorkHR.API/Controllers/UserTaskController.cs
  7. 1 1
      MTWorkHR.API/Program.cs
  8. 1 1
      MTWorkHR.Application/Dtos/Attendance/OrderRequestDto.cs
  9. 27 0
      MTWorkHR.Application/Dtos/User/UserTaskAllDto.cs
  10. 1 1
      MTWorkHR.Application/Dtos/User/UserTaskHistoryDto.cs
  11. 19 0
      MTWorkHR.Application/Dtos/User/UserTaskPagingInputDto.cs
  12. 10 1
      MTWorkHR.Application/Mapper/MappingProfile.cs
  13. 2 0
      MTWorkHR.Application/Services/Interfaces/IUserService.cs
  14. 2 0
      MTWorkHR.Application/Services/Interfaces/IUserTaskService.cs
  15. 2 2
      MTWorkHR.Application/Services/Task/ProjectService.cs
  16. 36 6
      MTWorkHR.Application/Services/Task/UserTaskService.cs
  17. 35 4
      MTWorkHR.Application/Services/User/OrderRequestService.cs
  18. 7 0
      MTWorkHR.Application/Services/User/UserService.cs
  19. 13 0
      MTWorkHR.Core/IDto/IUserTaskPagingInputDto.cs
  20. 1 0
      MTWorkHR.Core/IRepositories/User/IOrderRequestRepository.cs
  21. 12 11
      MTWorkHR.Infrastructure/Configurations/UserTaskStatusConfiguration.cs
  22. 1 1
      MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs
  23. 3418 0
      MTWorkHR.Infrastructure/Migrations/20240730134009_altrTaskHistory.Designer.cs
  24. 84 0
      MTWorkHR.Infrastructure/Migrations/20240730134009_altrTaskHistory.cs
  25. 5 11
      MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs
  26. 2 1
      MTWorkHR.Infrastructure/Repositories/Task/UserTaskRepository.cs
  27. 8 0
      MTWorkHR.Infrastructure/Repositories/User/OrderRequestRepository.cs

+ 1 - 1
MTWorkHR.API/Controllers/CompanyController.cs

@@ -52,7 +52,7 @@ namespace MTWorkHR.API.Controllers
         [HttpPost("Delete")]
         [ProducesResponseType(StatusCodes.Status200OK)]
 
-        public async Task Delete(long id)
+        public async Task Delete([FromQuery] long id)
         {
             await _companyService.Delete(id);
         }

+ 2 - 2
MTWorkHR.API/Controllers/MeetingController.cs

@@ -46,9 +46,9 @@ namespace MTWorkHR.API.Controllers
         [HttpPost("Update")]
         [ProducesResponseType(StatusCodes.Status200OK)]
 
-        public async Task Update([FromBody] MeetingDto input)
+        public async Task<ActionResult<MeetingDto>> Update([FromBody] MeetingDto input)
         {
-            await _MeetingService.Update(input);
+            return await _MeetingService.Update(input);
         }
 
         [HttpPost("Delete")]

+ 1 - 1
MTWorkHR.API/Controllers/ProjectController.cs

@@ -56,7 +56,7 @@ namespace MTWorkHR.API.Controllers
         [ProducesResponseType(StatusCodes.Status200OK)]
       //  [AppAuthorize(Permissions = "Project.Delete")]
 
-        public async Task Delete(long id)
+        public async Task Delete([FromQuery] long id)
         {
             await _ProjectService.Delete(id);
         }

+ 3 - 3
MTWorkHR.API/Controllers/TeamController.cs

@@ -50,16 +50,16 @@ namespace MTWorkHR.API.Controllers
         [ProducesResponseType(StatusCodes.Status200OK)]
    //     [AppAuthorize(Permissions = "Team.Update")]
 
-        public async Task Update([FromBody] TeamDto input)
+        public async Task<ActionResult<TeamDto>> Update([FromBody] TeamDto input)
         {
-            await _TeamService.Update(input);
+            return await _TeamService.Update(input);
         }
 
         [HttpPost("Delete")]
         [ProducesResponseType(StatusCodes.Status200OK)]
       //  [AppAuthorize(Permissions = "Team.Delete")]
 
-        public async Task Delete(long id)
+        public async Task Delete([FromQuery] long id)
         {
             await _TeamService.Delete(id);
         }

+ 1 - 1
MTWorkHR.API/Controllers/UserController.cs

@@ -57,7 +57,7 @@ namespace MTWorkHR.API.Controllers
         [HttpPost("Delete")]
         [ProducesResponseType(StatusCodes.Status200OK)]
 
-        public async Task Delete(string id)
+        public async Task Delete([FromQuery] string id)
         {
             await _userService.Delete(id);
         }

+ 3 - 2
MTWorkHR.API/Controllers/UserTaskController.cs

@@ -18,13 +18,14 @@ namespace MTWorkHR.API.Controllers
         private readonly IUserTaskService _userTaskService;
         private readonly IUserTaskAttachmentService _attachmentService;
         private readonly IUserTaskHistoryService _taskHistoryService;
-        public UserTaskController(IUserTaskService userUserTaskService, IUserTaskAttachmentService attachmentService)
+        public UserTaskController(IUserTaskService userUserTaskService, IUserTaskAttachmentService attachmentService, IUserTaskHistoryService taskHistoryService)
         {
             this._userTaskService = userUserTaskService;
             _attachmentService = attachmentService;
+            _taskHistoryService = taskHistoryService;
         }
         [HttpGet("GetAll")]
-        public async Task<ActionResult<List<UserTaskDto>>> GetAll([FromQuery]PagingInputDto pagingInput)
+        public async Task<ActionResult<List<UserTaskAllDto>>> GetAll([FromQuery]UserTaskPagingInputDto pagingInput)
         {
             return Ok(await _userTaskService.GetAll(pagingInput));
         }

+ 1 - 1
MTWorkHR.API/Program.cs

@@ -20,7 +20,7 @@ var config = new AppSettingsConfiguration();
 // Add services to the container.
 builder.Services.AddDbContext<HRDataContext>(options =>
 {
-    options.UseSqlServer(config.ConnectionStrings.MTWorkHRConnectionString);
+    options.UseSqlServer(config.ConnectionStrings.LocalConnectionString);
   //  options.UseSqlServer(builder.Configuration.GetSection("ConnectionStrings:MTWorkHRConnectionString").Value);
 });
 

+ 1 - 1
MTWorkHR.Application/Dtos/Attendance/OrderRequestDto.cs

@@ -15,7 +15,7 @@ namespace MTWorkHR.Application.Models
     {
         public DateTime StartDate { get; set; }
         public DateTime EndDate { get; set; }
-        public string RequestingEmployeeId { get; set; }
+        public string? RequestingEmployeeId { get; set; }
         public int OrderTypeId { get; set; }
         public int? LeaveTypeId { get; set; }
         public string? RequestComments { get; set; }

+ 27 - 0
MTWorkHR.Application/Dtos/User/UserTaskAllDto.cs

@@ -0,0 +1,27 @@
+using Microsoft.AspNetCore.Http;
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.Entities.Base;
+using MTWorkHR.Core.Global;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace MTWorkHR.Application.Models
+{
+        public class UserTaskAllDto : EntityDto
+        {
+            public string AssignedUserId { get; set; }
+            public string? AssignedUserName { get; set; }
+            public string? ProfileImage { get; set; }
+            public string Title { get; set; }
+            public string Description { get; set; }
+            public DateTime DueDate { get; set; }
+            public PriorityEnum Priority { get; set; }
+            public int ProjectId { get; set; }
+
+            public long StatusId { get; set; }
+            public int AttachmentCount { get; set; }
+            public int CommentsCount { get; set; }
+            public string? CreateUser { get; set; }
+
+        }
+}

+ 1 - 1
MTWorkHR.Application/Dtos/User/UserTaskHistoryDto.cs

@@ -13,7 +13,7 @@ namespace MTWorkHR.Application.Models
         [MaxLength(500)]
         public string? Comment { get; set; }
 
-        public long TaskId { get; set; }
+        public long UserTaskId { get; set; }
 
         public long CurrentStatusId { get; set; }
 

+ 19 - 0
MTWorkHR.Application/Dtos/User/UserTaskPagingInputDto.cs

@@ -0,0 +1,19 @@
+using MTWorkHR.Core.IDto;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Application.Models
+{
+    public class UserTaskPagingInputDto : PagingInputDto, IUserTaskPagingInputDto
+    {
+        public long? ProjectId { get; set; }
+        public long? StatusId { get; set; }
+        public int? PriorityId { get; set; }
+        public string? AssignedUserId { get; set; }
+        
+
+    }
+}

+ 10 - 1
MTWorkHR.Application/Mapper/MappingProfile.cs

@@ -1,4 +1,5 @@
 using AutoMapper;
+using Azure;
 using Countries.NET;
 using Microsoft.AspNetCore.Identity;
 using MTWorkHR.Application.Models;
@@ -74,14 +75,22 @@ namespace MTWorkHR.Application.Mapper
 
             CreateMap<RolePermissionDto, RolePermission>().ReverseMap();
 
-            CreateMap<ProjectDto, Project>().ForMember(d => d.CreateDate, o => o.Ignore()).ForMember(d => d.CreateUser, o => o.Ignore()).ReverseMap();
+            CreateMap<ProjectDto, Project>().ForMember(d => d.CreateDate, o => o.Ignore()).ForMember(d => d.CreateUser, o => o.Ignore());
             CreateMap<UserTaskDto, UserTask>().ForMember(d => d.CreateDate, o => o.Ignore()).ForMember(d => d.CreateUser, o => o.Ignore()).ReverseMap();
             CreateMap<UserTaskAttachment, AttachmentDto>().ReverseMap();
             CreateMap<UserTaskHistoryDto, UserTaskHistory>().ForMember(d => d.CreateDate, o => o.Ignore()).ReverseMap();
+
+            CreateMap<UserTask, UserTaskAllDto>()
+            .ForMember(s => s.AttachmentCount, o => o.MapFrom(s => s.TaskAttachments == null ? 0 : s.TaskAttachments.Count))
+            .ForMember(s => s.CommentsCount, o => o.MapFrom(s => s.UserTaskHistories== null ? 0 : s.UserTaskHistories.Count));
+
+
             CreateMap<Team, TeamDto>().ReverseMap().ForMember(d => d.CreateDate, o => o.Ignore());
             CreateMap<TeamUserDto, TeamUser>().ForMember(d => d.CreateDate, o => o.Ignore()).ReverseMap();
             CreateMap<Team, TeamAllDto>()
              .ForMember(s => s.TeamUserCount, o => o.MapFrom(s => s.TeamUsers == null ? 0 :  s.TeamUsers.Count));
+            CreateMap<Project, ProjectDto>()
+            .ForMember(s => s.ProjectTeamIds, o => o.MapFrom(s => s.ProjectTeams != null ? s.ProjectTeams.Select(u => u.TeamId).ToList() : new List<long>()));
 
 
             CreateMap<Meeting, MeetingDto>();

+ 2 - 0
MTWorkHR.Application/Services/Interfaces/IUserService.cs

@@ -30,5 +30,7 @@ namespace MTWorkHR.Application.Identity
 
         Task<List<UserAllDto>> GetAllCompanyEmployees();
         Task<BlobObject> Download(string filePath);
+        Task<UserDto> GetUserWithAttachmentById(string id);
+
     }
 }

+ 2 - 0
MTWorkHR.Application/Services/Interfaces/IUserTaskService.cs

@@ -9,5 +9,7 @@ namespace MTWorkHR.Application.Services.Interfaces
     public interface IUserTaskService : IService<UserTask, UserTaskDto, UserTaskDto>
     {
         Task<UserTaskDto> GetByUserId(string userId);
+        Task<PagingResultDto<UserTaskAllDto>> GetAll(UserTaskPagingInputDto PagingInputDto);
+
     }
 }

+ 2 - 2
MTWorkHR.Application/Services/Task/ProjectService.cs

@@ -34,8 +34,8 @@ namespace MTWorkHR.Application.Services
         {
             var entity = await _unitOfWork.Project.GetByIdWithAllChildren(id);
             var response = MapperObject.Mapper.Map<ProjectDto>(entity);
-            if (response != null)
-                response.ProjectTeamIds = response.ProjectTeams != null ? response.ProjectTeams?.Select(u => u.TeamId).ToList() : new List<long>();
+           // if (response != null)
+           //     response.ProjectTeamIds = response.ProjectTeams != null ? response.ProjectTeams?.Select(u => u.TeamId).ToList() : new List<long>();
             return response;
         }
         public override async Task<ProjectDto> Create(ProjectDto input)

+ 36 - 6
MTWorkHR.Application/Services/Task/UserTaskService.cs

@@ -8,6 +8,7 @@ using MTWorkHR.Core.Global;
 using Microsoft.EntityFrameworkCore;
 using System.Linq.Dynamic.Core;
 using MTWorkHR.Core.IDto;
+using MTWorkHR.Application.Identity;
 
 namespace MTWorkHR.Application.Services
 {
@@ -18,12 +19,14 @@ namespace MTWorkHR.Application.Services
         //private readonly GlobalInfo _globalInfo;
         private readonly IFileService _fileService;
         private readonly GlobalInfo _globalInfo;
+        private readonly IUserService _userService;
 
-        public UserTaskService(IUnitOfWork unitOfWork, IFileService fileService, GlobalInfo globalInfo) : base(unitOfWork)
+        public UserTaskService(IUnitOfWork unitOfWork, IFileService fileService, GlobalInfo globalInfo, IUserService userService) : base(unitOfWork)
         {
             _unitOfWork = unitOfWork;
             _fileService = fileService;
             _globalInfo = globalInfo;
+            _userService = userService;
         }
 
 
@@ -40,7 +43,7 @@ namespace MTWorkHR.Application.Services
             return response;
         }
 
-        public override async Task<PagingResultDto<UserTaskDto>> GetAll(PagingInputDto PagingInputDto)
+        public async Task<PagingResultDto<UserTaskAllDto>> GetAll(UserTaskPagingInputDto PagingInputDto)
         {
             var res = await _unitOfWork.UserTask.GetAllWithChildrenAsync();
             var query = res.Item1;
@@ -59,7 +62,22 @@ namespace MTWorkHR.Application.Services
                 var filter = PagingInputDto.Filter;
                 query = query.Where(u => u.Title.Contains(filter) || u.Description.Contains(filter));
             }
-
+            if (PagingInputDto.ProjectId != null)
+            {
+                query = query.Where(u => u.ProjectId == PagingInputDto.ProjectId);
+            }
+            if (PagingInputDto.StatusId != null)
+            {
+                query = query.Where(u => u.StatusId == PagingInputDto.StatusId);
+            }
+            if (PagingInputDto.PriorityId != null)
+            {
+                query = query.Where(u => u.Priority == (PriorityEnum)PagingInputDto.PriorityId);
+            }
+            if (PagingInputDto.AssignedUserId != null)
+            {
+                query = query.Where(u => u.AssignedUserId == PagingInputDto.AssignedUserId);
+            }
             var order = query.OrderBy(PagingInputDto.OrderByField + " " + PagingInputDto.OrderType);
 
             var page = order.Skip((PagingInputDto.PageNumber * PagingInputDto.PageSize) - PagingInputDto.PageSize).Take(PagingInputDto.PageSize);
@@ -67,9 +85,21 @@ namespace MTWorkHR.Application.Services
             var total = await query.CountAsync();
 
             var list = MapperObject.Mapper
-                .Map<IList<UserTaskDto>>(await page.ToListAsync());
-
-            var response = new PagingResultDto<UserTaskDto>
+                .Map<IList<UserTaskAllDto>>(await page.ToListAsync());
+            foreach (var item in list)
+            {
+                if (item.AssignedUserId != null)
+                {
+                    var user = await _userService.GetUserWithAttachmentById(item.AssignedUserId);
+                    if(user != null)
+                    {
+                        item.AssignedUserName = user.FirstName + " " + user.LastName;
+                        var image = user.UserAttachments?.FirstOrDefault(a => a.AttachmentTypeId == 9); 
+                        item.ProfileImage = image != null ? image.FilePath:"";
+                    }
+                }
+            }
+            var response = new PagingResultDto<UserTaskAllDto>
             {
                 Result = list,
                 Total = total

+ 35 - 4
MTWorkHR.Application/Services/User/OrderRequestService.cs

@@ -14,9 +14,7 @@ using MTWorkHR.Core.Email;
 using MTWorkHR.Core.Entities;
 using MTWorkHR.Infrastructure.UnitOfWorks;
 using MTWorkHR.Core.Entities.User;
-using Azure;
-using System.Security.Claims;
-using MTWorkHR.Core.Entities.Base;
+using System.Linq.Dynamic.Core;
 
 namespace MTWorkHR.Application.Services
 {
@@ -25,12 +23,14 @@ namespace MTWorkHR.Application.Services
         private readonly IUnitOfWork _unitOfWork;
         private readonly IMailSender _emailSender;
         private readonly ApplicationUserManager _userManager;
+        private readonly GlobalInfo _globalInfo;
 
-        public OrderRequestService(IUnitOfWork unitOfWork, IMailSender emailSender, ApplicationUserManager userManager) : base(unitOfWork)
+        public OrderRequestService(IUnitOfWork unitOfWork, IMailSender emailSender, ApplicationUserManager userManager, GlobalInfo globalInfo) : base(unitOfWork)
         {
             _unitOfWork = unitOfWork;
             _emailSender = emailSender;
             _userManager = userManager;
+            _globalInfo = globalInfo;
         }
 
 
@@ -40,9 +40,40 @@ namespace MTWorkHR.Application.Services
             var response = MapperObject.Mapper.Map<OrderRequestDto>(entity);
             return response;
         }
+        public override async Task<PagingResultDto<OrderRequestDto>> GetAll(PagingInputDto PagingInputDto)
+        {
+            var res = await _unitOfWork.OrderRequest.GetAllWithChildrenAsync();
+            var query = res.Item1;
+            if (_globalInfo.UserType != UserTypeEnum.Business)
+            {
+                query = query.Where(m => m.RequestingEmployeeId != null && m.RequestingEmployeeId == _globalInfo.UserId);
+
+            }
+
+            var order = query.OrderBy(PagingInputDto.OrderByField + " " + PagingInputDto.OrderType);
+
+            var page = order.Skip((PagingInputDto.PageNumber * PagingInputDto.PageSize) - PagingInputDto.PageSize).Take(PagingInputDto.PageSize);
+
+            var total = await query.CountAsync();
+
+            var list = MapperObject.Mapper
+                .Map<IList<OrderRequestDto>>(await page.ToListAsync());
+
+            var response = new PagingResultDto<OrderRequestDto>
+            {
+                Result = list,
+                Total = total
+            };
+
+            return response;
+        }
         public override async Task<OrderRequestDto> Create(OrderRequestDto input)
         {
             var period = DateTime.Now.Year;
+            if(string.IsNullOrEmpty( input.RequestingEmployeeId))
+            {
+                input.RequestingEmployeeId = _globalInfo.UserId;
+            }
             var allocation = await _unitOfWork.OrderAllocation.GetUserAllocations(input.RequestingEmployeeId, input.OrderTypeId, input.LeaveTypeId, period);
 
             if (allocation is null)

+ 7 - 0
MTWorkHR.Application/Services/User/UserService.cs

@@ -139,7 +139,14 @@ namespace MTWorkHR.Application.Services
             var name = entity == null ? "" : entity.FirstName + " " + entity.LastName;
             return name;
         }
+        public async Task<UserDto> GetUserWithAttachmentById(string id)
+        {
+            var entity = await _userManager.Users.Include(u=> u.UserAttachments)
+                .FirstOrDefaultAsync(x => x.Id == id);
+            var response = MapperObject.Mapper.Map<UserDto>(entity);
 
+            return response;
+        }
         //public async Task<List<UserDto>> GetAll(PagingInputDto pagingInput)
         //{
         //    var employees = await _userManager.GetUsersInRoleAsync("Employee");

+ 13 - 0
MTWorkHR.Core/IDto/IUserTaskPagingInputDto.cs

@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+
+namespace MTWorkHR.Core.IDto
+{
+    public interface IUserTaskPagingInputDto:IPagingInputDto
+    {
+        public long? ProjectId { get; set; }
+        public long? StatusId { get; set; }
+        public int? PriorityId { get; set; }
+        public string? AssignedUserId { get; set; }
+
+    }
+}

+ 1 - 0
MTWorkHR.Core/IRepositories/User/IOrderRequestRepository.cs

@@ -12,6 +12,7 @@ namespace MTWorkHR.Core.IRepositories
     public interface IOrderRequestRepository : IRepository<OrderRequest>
     {
        Task<OrderRequest> GetByIdWithAllChildren(long id);
+        Task<Tuple<IQueryable<OrderRequest>, int>> GetAllWithChildrenAsync();
 
     }
 }

+ 12 - 11
MTWorkHR.Infrastructure/Configurations/UserTaskStatusConfiguration.cs

@@ -22,34 +22,35 @@ namespace MTWorkHR.Infrastructure.Configurations
                 new UserTaskStatus
                 {
                     Id = 1,
-                    NameEn = "New",
+                    NameEn = "To Do",
                     NameAr = "جديدة"
                 },
                 new UserTaskStatus
                 {
                 Id = 2,
-                    NameEn = "Under progress",
+                    NameEn = "In progress",
                     NameAr = "قيد العمل"
                 },
                 new UserTaskStatus
                 {
                     Id = 3,
-                    NameEn = "Closed",
-                    NameAr = "أغلقت"
+                    NameEn = "Need Review",
+                    NameAr = "تحتاج مراجعة"
                 }
                 ,
                 new UserTaskStatus
                 {
                     Id = 4,
-                    NameEn = "Completed", //(after closed from employee / manager)
+                    NameEn = "Done", //(after closed from employee / manager)
                     NameAr = "تمت"
-                },
-                new UserTaskStatus
-                {
-                    Id = 5,
-                    NameEn = "Delayed",
-                    NameAr = "مؤجلة"
                 }
+                //,
+                //new UserTaskStatus
+                //{
+                //    Id = 5,
+                //    NameEn = "Delayed",
+                //    NameAr = "مؤجلة"
+                //}
                ) ;
         }
     }

+ 1 - 1
MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs

@@ -31,7 +31,7 @@ namespace MTWorkHR.Infrastructure
             
             services.AddDbContext<HRDataContext>(options =>
                 options.UseSqlServer(
-                    config.ConnectionStrings.MTWorkHRConnectionString  //configuration.GetSection("ConnectionString:MTWorkHRConnectionString").Value
+                    config.ConnectionStrings.LocalConnectionString  //configuration.GetSection("ConnectionString:MTWorkHRConnectionString").Value
                     ));
            
             services.AddIdentity<ApplicationUser, ApplicationRole>().AddEntityFrameworkStores<HRDataContext>().AddDefaultTokenProviders();

File diff suppressed because it is too large
+ 3418 - 0
MTWorkHR.Infrastructure/Migrations/20240730134009_altrTaskHistory.Designer.cs


+ 84 - 0
MTWorkHR.Infrastructure/Migrations/20240730134009_altrTaskHistory.cs

@@ -0,0 +1,84 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    /// <inheritdoc />
+    public partial class altrTaskHistory : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DeleteData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 5L);
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 1L,
+                column: "NameEn",
+                value: "To Do");
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 2L,
+                column: "NameEn",
+                value: "In progress");
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 3L,
+                columns: new[] { "NameAr", "NameEn" },
+                values: new object[] { "تحتاج مراجعة", "Need Review" });
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 4L,
+                column: "NameEn",
+                value: "Done");
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 1L,
+                column: "NameEn",
+                value: "New");
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 2L,
+                column: "NameEn",
+                value: "Under progress");
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 3L,
+                columns: new[] { "NameAr", "NameEn" },
+                values: new object[] { "أغلقت", "Closed" });
+
+            migrationBuilder.UpdateData(
+                table: "UserTaskStatuses",
+                keyColumn: "Id",
+                keyValue: 4L,
+                column: "NameEn",
+                value: "Completed");
+
+            migrationBuilder.InsertData(
+                table: "UserTaskStatuses",
+                columns: new[] { "Id", "NameAr", "NameEn" },
+                values: new object[] { 5L, "مؤجلة", "Delayed" });
+        }
+    }
+}

+ 5 - 11
MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs

@@ -2511,31 +2511,25 @@ namespace MTWorkHR.Infrastructure.Migrations
                         {
                             Id = 1L,
                             NameAr = "جديدة",
-                            NameEn = "New"
+                            NameEn = "To Do"
                         },
                         new
                         {
                             Id = 2L,
                             NameAr = "قيد العمل",
-                            NameEn = "Under progress"
+                            NameEn = "In progress"
                         },
                         new
                         {
                             Id = 3L,
-                            NameAr = "أغلقت",
-                            NameEn = "Closed"
+                            NameAr = "تحتاج مراجعة",
+                            NameEn = "Need Review"
                         },
                         new
                         {
                             Id = 4L,
                             NameAr = "تمت",
-                            NameEn = "Completed"
-                        },
-                        new
-                        {
-                            Id = 5L,
-                            NameAr = "مؤجلة",
-                            NameEn = "Delayed"
+                            NameEn = "Done"
                         });
                 });
 

+ 2 - 1
MTWorkHR.Infrastructure/Repositories/Task/UserTaskRepository.cs

@@ -39,7 +39,8 @@ namespace MTWorkHR.Infrastructure.Repositories
 
         public async Task<Tuple<IQueryable<UserTask>, int>> GetAllWithChildrenAsync()
         {
-            var query = dbSet.Include(x => x.Project).AsQueryable();
+            var query = dbSet.Include(x => x.Project).Include(x => x.TaskAttachments)
+                .Include(x => x.UserTaskHistories).AsQueryable();
             var total = await query.CountAsync();
 
             return new Tuple<IQueryable<UserTask>, int>(query, total);

+ 8 - 0
MTWorkHR.Infrastructure/Repositories/User/OrderRequestRepository.cs

@@ -22,5 +22,13 @@ namespace MTWorkHR.Infrastructure.Repositories
                 .Include(x => x.OrderType)
                 .FirstOrDefaultAsync(x => x.Id == id);
         }
+
+        public async Task<Tuple<IQueryable<OrderRequest>, int>> GetAllWithChildrenAsync()
+        {
+            var query = dbSet.Include(x => x.OrderType).Include(x=> x.LeaveType).AsQueryable();
+            var total = await query.CountAsync();
+
+            return new Tuple<IQueryable<OrderRequest>, int>(query, total);
+        }
     }
 }