浏览代码

- Company Entity
- UserAttachments and address

zinab 9 月之前
父节点
当前提交
36bd9d89fa
共有 47 个文件被更改,包括 2362 次插入157 次删除
  1. 3 2
      MTWorkHR.API/Program.cs
  2. 4 4
      MTWorkHR.API/appsettings.json
  3. 1 1
      MTWorkHR.Application/ApplicationServiceRegistration.cs
  4. 1 1
      MTWorkHR.Application/Filters/AppAuth.cs
  5. 6 1
      MTWorkHR.Application/Mapper/MappingProfile.cs
  6. 14 0
      MTWorkHR.Application/Models/Identity/UserAddressDto.cs
  7. 18 0
      MTWorkHR.Application/Models/Identity/UserAttachmentDto.cs
  8. 11 0
      MTWorkHR.Application/Models/Identity/UserDto.cs
  9. 2 2
      MTWorkHR.Application/Services/Auth/AuthService.cs
  10. 1 2
      MTWorkHR.Application/Services/Auth/UserService.cs
  11. 14 14
      MTWorkHR.Application/Services/EmployeeService.cs
  12. 0 15
      MTWorkHR.Core/EmailSettings.cs
  13. 20 0
      MTWorkHR.Core/Entities/Auth/Company.cs
  14. 22 0
      MTWorkHR.Core/Entities/Base/AttachmentType.cs
  15. 20 20
      MTWorkHR.Core/AppSettingsConfiguration.cs
  16. 15 0
      MTWorkHR.Core/IRepositories/Auth/ICompanyRepository.cs
  17. 2 9
      MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs
  18. 1 1
      MTWorkHR.Identity/Configurations/RoleConfiguration.cs
  19. 3 1
      MTWorkHR.Identity/Configurations/UserConfiguration.cs
  20. 1 1
      MTWorkHR.Identity/DBContext/HRIdentityDBContext.cs
  21. 1 1
      MTWorkHR.Identity/Models/ApplicationRole.cs
  22. 10 1
      MTWorkHR.Identity/Models/ApplicationUser.cs
  23. 1 1
      MTWorkHR.Identity/Models/ApplicationUserManager.cs
  24. 1 1
      MTWorkHR.Identity/Models/IdentityExtension.cs
  25. 1 1
      MTWorkHR.Identity/Models/JwtSettings.cs
  26. 1 1
      MTWorkHR.Identity/Models/Permission.cs
  27. 1 1
      MTWorkHR.Identity/Models/RolePermission.cs
  28. 19 0
      MTWorkHR.Identity/Entities/UserAddress.cs
  29. 24 0
      MTWorkHR.Identity/Entities/UserAttachment.cs
  30. 8 12
      MTWorkHR.Identity/IdentityServiceRegistration.cs
  31. 18 18
      MTWorkHR.Identity/Migrations/20240128145047_InitialCreate.Designer.cs
  32. 667 0
      MTWorkHR.Identity/Migrations/20240131192843_updateUser.Designer.cs
  33. 170 0
      MTWorkHR.Identity/Migrations/20240131192843_updateUser.cs
  34. 735 0
      MTWorkHR.Identity/Migrations/20240131193715_updateUserAddress.Designer.cs
  35. 55 0
      MTWorkHR.Identity/Migrations/20240131193715_updateUserAddress.cs
  36. 220 18
      MTWorkHR.Identity/Migrations/HRIdentityDBContextModelSnapshot.cs
  37. 1 0
      MTWorkHR.Infrastructure/Data/HRDataContext.cs
  38. 1 1
      MTWorkHR.Infrastructure/EmailService/EmailSender.cs
  39. 30 3
      MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs
  40. 79 0
      MTWorkHR.Infrastructure/Migrations/20240131192339_addCompany.Designer.cs
  41. 43 0
      MTWorkHR.Infrastructure/Migrations/20240131192339_addCompany.cs
  42. 76 0
      MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs
  43. 17 17
      MTWorkHR.Infrastructure/PersistenceServiceRegistration.cs
  44. 1 1
      MTWorkHR.Infrastructure/Repositories/Auth/RolePermissionRepository.cs
  45. 0 5
      MTWorkHR.Infrastructure/Repositories/Auth/UserRoleRepository.cs
  46. 17 0
      MTWorkHR.Infrastructure/Repositories/User/CompanyRepository.cs
  47. 6 1
      MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs

+ 3 - 2
MTWorkHR.API/Program.cs

@@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
 using MTWorkHR.Infrastructure.Data;
 using Microsoft.EntityFrameworkCore;
 using MTWorkHR.Core;
+using MTWorkHR.Core.Global;
 
 var builder = WebApplication.CreateBuilder(args);
 
@@ -15,8 +16,8 @@ builder.Services.AddDbContext<HRDataContext>(options => {
 var config = new AppSettingsConfiguration();
 builder.Configuration.Bind(config);
 builder.Services.AddApplicationServices(config);
-builder.Services.AddInfrastructureServices(builder.Configuration);
-builder.Services.AddPersistenceServices(builder.Configuration);
+builder.Services.AddInfrastructureServices(config);
+//builder.Services.AddPersistenceServices(builder.Configuration);
 builder.Services.AddIdentityServices(config);
 
 builder.Services.AddControllers();

+ 4 - 4
MTWorkHR.API/appsettings.json

@@ -6,7 +6,7 @@
     }
   },
   "ConnectionStrings": {
-    "MTWorkHRConnectionString": "Server=localhost;Database=MTWorkHR;User=sa;Password=p@ssw0rd;MultipleActiveResultSets=true;Integrated Security=True;Encrypt=False"
+    "MTWorkHRConnectionString": "Server=localhost;Database=MTWorkHRDB;User=sa;Password=p@ssw0rd;MultipleActiveResultSets=true;Integrated Security=True;Encrypt=False"
     // "HRIdentityDB": "Server=localhost;Database=HRIdentityDB;User=sa;Password=p@ssw0rd;MultipleActiveResultSets=true"
     //Data Source=.;Initial Catalog=CBQ_VIVR;Integrated Security=True;Encrypt=False
   },
@@ -26,10 +26,10 @@
 
   "MailSettings": {
     "ApiKey": "SendGrid-Key",
-    "FromAddress": "zinab.elgendy@rabbittec.com",
+    "FromAddress": "eng_z@live.com",
     "FromName": "Hr Management System",
-    "Password": "Rabbit@321",
-    "Host": "smtp.zoho.com",
+    "Password": "j,jij,ji",
+    "Host": "smtp-mail.outlook.com",
     "Port": 587,
     "TemplatePath": "C:\\Attachment\\MailTemp\\EmailTemplate.html"
   },

+ 1 - 1
MTWorkHR.Application/ApplicationServiceRegistration.cs

@@ -2,7 +2,7 @@
 using Microsoft.Extensions.DependencyInjection;
 using MTWorkHR.Application.Identity;
 using MTWorkHR.Application.Services;
-using MTWorkHR.Core;
+using MTWorkHR.Core.Global;
 using MTWorkHR.Identity.Services;
 using System.Reflection;
 

+ 1 - 1
MTWorkHR.Application/Filters/AppAuth.cs

@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc.Filters;
 using Microsoft.Extensions.DependencyInjection;
 using MTWorkHR.Core.Global;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 
 namespace MTWorkHR.Application.Filters
 {

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

@@ -2,7 +2,7 @@
 using Microsoft.AspNetCore.Identity;
 using MTWorkHR.Application.Models;
 using MTWorkHR.Core.Global;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -37,6 +37,8 @@ namespace MTWorkHR.Application.MappingProfiles
 
             CreateMap<ApplicationUser, UserUpdateDto>();
 
+            CreateMap<UserAttachmentDto, UserAttachment>().ReverseMap();
+            CreateMap<UserAddress, UserAddressDto>().ReverseMap();
 
             //identity userRoles
             CreateMap<IdentityUserRole<string>, UserRoleDto>().ReverseMap();
@@ -55,6 +57,9 @@ namespace MTWorkHR.Application.MappingProfiles
 
             CreateMap<RolePermissionDto, RolePermission>().ReverseMap();
 
+        
+
+
         }
     }
 }

+ 14 - 0
MTWorkHR.Application/Models/Identity/UserAddressDto.cs

@@ -0,0 +1,14 @@
+using MTWorkHR.Identity.Entities;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace MTWorkHR.Application.Models
+{
+    public class UserAddressDto
+    {
+        public int CountryId { get; set; }
+        public string City { get; set; }
+        public string PostalCode { get; set; }
+        public string AddressDesc { get; set; }
+    }
+}

+ 18 - 0
MTWorkHR.Application/Models/Identity/UserAttachmentDto.cs

@@ -0,0 +1,18 @@
+using MTWorkHR.Core.Entities.Base;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace MTWorkHR.Application.Models
+{
+    public class UserAttachmentDto
+    {
+        public long AttachmentTypeId { get; set; }
+
+        public string? AttachmentTypeName { get; set; }
+
+        public string FileName { get; set; }
+
+        public string OriginalName { get; set; }
+
+    }
+}

+ 11 - 0
MTWorkHR.Application/Models/Identity/UserDto.cs

@@ -25,6 +25,17 @@ namespace MTWorkHR.Application.Models
         [MinLength(6)]
         public string UserName { get; set; }
         public string Password { get; set; }
+
+        public string? FavoriteName { get; set; }
+        public string PassportNumber { get; set; }
+        public int? QualificationId { get; set; }
+        public string? University { get; set; }
+        public string? JobTitle { get; set; }
+        public decimal TaxNumber { get; set; }
+        public decimal IncomeTaxValue { get; set; }
+
         public IList<UserRoleDto>? UserRoles { get; set; }
+        public IList<UserAttachmentDto>? UserAttachments{ get; set; }
+        public UserAddressDto? UserAddress{ get; set; }
     }
 }

+ 2 - 2
MTWorkHR.Application/Services/Auth/AuthService.cs

@@ -4,8 +4,8 @@ using Microsoft.IdentityModel.Tokens;
 using MTWorkHR.Application.Exceptions;
 using MTWorkHR.Application.Identity;
 using MTWorkHR.Application.Models;
-using MTWorkHR.Core;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Core.Global;
+using MTWorkHR.Identity.Entities;
 using System.IdentityModel.Tokens.Jwt;
 using System.Security.Claims;
 using System.Text;

+ 1 - 2
MTWorkHR.Application/Services/Auth/UserService.cs

@@ -10,13 +10,12 @@ using MTWorkHR.Application.Models.Email;
 using MTWorkHR.Core.Global;
 using MTWorkHR.Core.IRepositories;
 using MTWorkHR.Core.UnitOfWork;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using MTWorkHR.Core;
 using NeomtechERP.Auth.Core.Global;
 using Microsoft.AspNetCore.Identity.UI.Services;
 using IEmailSender = MTWorkHR.Application.Services.IEmailSender;

+ 14 - 14
MTWorkHR.Application/Services/EmployeeService.cs

@@ -11,38 +11,38 @@ using System.Threading.Tasks;
 
 namespace MTWorkHR.Application.Services
 {
-    public class EmployeeService
+    public class CompanyService
     {
-        private readonly IEmployeeRepository _employeeRepository;
+        private readonly ICompanyRepository _companyRepository;
         private readonly IMapper _mapper;
         private readonly IAppLogger<UserDto> _logger;
-        public EmployeeService(IEmployeeRepository employeeRepository, IMapper mapper, IAppLogger<UserDto> logger) 
+        public CompanyService(ICompanyRepository companyRepository, IMapper mapper, IAppLogger<UserDto> logger) 
         {
-            _employeeRepository = employeeRepository;
+            _companyRepository = companyRepository;
             _mapper = mapper;
             _logger = logger;
         }
         public UserDto Get(int id)
         {
-            var employeeDto = new UserDto();
+            var companyDto = new UserDto();
             try
             {
-                var emp = _employeeRepository.GetByIdAsync(id);
-                if (emp == null)
+                var company = _companyRepository.GetByIdAsync(id);
+                if (company == null)
                 {
-                    _logger.LogWarning("NOT FOUND Emp");
-                    throw new NotFoundException("Employee not in DB", id);
+                    _logger.LogWarning("NOT FOUND Company");
+                    throw new NotFoundException("company not in DB", id);
                 }
                 else
-                    _logger.LogInformation("OK _ Found Employee");
+                    _logger.LogInformation("OK _ Found company");
 
-                _mapper.Map(emp, employeeDto);
+                _mapper.Map(company, companyDto);
             }catch(Exception e)
             {
-                _logger.LogWarning($"emp [{id}]" + e.Message);
-                throw new BadRequest($"empExc [{id}]" + e.Message);
+                _logger.LogWarning($"company [{id}]" + e.Message);
+                throw new BadRequest($"companyExc [{id}]" + e.Message);
             }
-            return employeeDto;
+            return companyDto;
         }
     }
 }

+ 0 - 15
MTWorkHR.Core/EmailSettings.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MTWorkHR.Core
-{
-    public class EmailSettingssssssssssssss
-    {
-        public string ApiKey { get; set; }
-        public string FromAddress { get; set; }
-        public string FromName { get; set; }
-    }
-}

+ 20 - 0
MTWorkHR.Core/Entities/Auth/Company.cs

@@ -0,0 +1,20 @@
+using MTWorkHR.Core.Entities.Base;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.Entities
+{
+    public class Company : AuditEntity
+    {
+        public long UserId { get; set; }
+
+        public string CompanyName { get; set; }
+        public string CRNumber { get; set; }
+        public decimal TaxNumber { get; set; }
+        public bool IsDeleted { get; set; }
+    }
+}

+ 22 - 0
MTWorkHR.Core/Entities/Base/AttachmentType.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.Entities.Base
+{
+    public class AttachmentType: Entity
+    {
+        [Required]
+        [MaxLength(250)]
+        [Filter]
+        public string NameAr { get; set; }
+        [Required]
+        [MaxLength(250)]
+        [Filter]
+        public string NameEn { get; set; }
+        public bool IsRequired { get; set; }
+    }
+}

+ 20 - 20
MTWorkHR.Core/AppSettingsConfiguration.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Core
+namespace MTWorkHR.Core.Global
 {
     public class AppSettingsConfiguration
     {
@@ -52,30 +52,30 @@ namespace MTWorkHR.Core
 
     }
 
- 
+
     public class OTPSettings
-	{
-		public int Length { get; set; }
-		public int ExpirePeriodInMinutes { get; set; }
-		public string MessageSubject { get; set; }
-		public string MessageBody { get; set; }
-		public bool SendEmail { get; set; }
-		public bool SendSMS { get; set; }
-		public bool AllowZeros { get; set; }
+    {
+        public int Length { get; set; }
+        public int ExpirePeriodInMinutes { get; set; }
+        public string MessageSubject { get; set; }
+        public string MessageBody { get; set; }
+        public bool SendEmail { get; set; }
+        public bool SendSMS { get; set; }
+        public bool AllowZeros { get; set; }
 
-	}
-	public class CaptchaSettings
-	{
-		public int Length { get; set; }
-		public int ExpirePeriodInSeconds { get; set; }
+    }
+    public class CaptchaSettings
+    {
+        public int Length { get; set; }
+        public int ExpirePeriodInSeconds { get; set; }
 
-	}
+    }
     public class LoginSettings
-	{
-		public int MaxFailedAccessAttempts { get; set; }
-		public int DefaultLockoutTimeSpanInDays { get; set; }
+    {
+        public int MaxFailedAccessAttempts { get; set; }
+        public int DefaultLockoutTimeSpanInDays { get; set; }
 
-	}
+    }
 
     public class IntegrationHttp
     {

+ 15 - 0
MTWorkHR.Core/IRepositories/Auth/ICompanyRepository.cs

@@ -0,0 +1,15 @@
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IDto;
+using MTWorkHR.Core.IRepositories.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Core.IRepositories
+{
+    public interface ICompanyRepository : IRepository<Company>
+    {
+    }
+}

+ 2 - 9
MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs

@@ -2,21 +2,14 @@
 using MTWorkHR.Core.Entities;
 using MTWorkHR.Core.IRepositories;
 using MTWorkHR.Core.IRepositories.Base;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
+
 
 namespace MTWorkHR.Core.UnitOfWork
 {
     public interface IUnitOfWork
     {
         IPermissionRepository Permission { get; }
-
-        //IRepository<Employee> Employee { get; }
-
+        ICompanyRepository Company { get; }
         Task<int> CompleteAsync();
 
         void BeginTran();

+ 1 - 1
MTWorkHR.Identity/Configurations/RoleConfiguration.cs

@@ -1,7 +1,7 @@
 using Microsoft.AspNetCore.Identity;
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore.Metadata.Builders;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 3 - 1
MTWorkHR.Identity/Configurations/UserConfiguration.cs

@@ -6,7 +6,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 
 namespace MTWorkHR.Identity.Configurations
 {
@@ -34,6 +34,7 @@ namespace MTWorkHR.Identity.Configurations
                     DeleteUserId = null,AccessFailedCount = 0,UserType = 1,
                     ConcurrencyStamp= "7cc87689-9eab-4280-b8e3-1834080783a5",
                     SecurityStamp = "49bb16c3-4704-4c60-908d-dc8506950acc",
+                    PassportNumber = "1234567",
                     PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==" //hasher.HashPassword(null, "P@ssword1")
                 },
                 new ApplicationUser
@@ -55,6 +56,7 @@ namespace MTWorkHR.Identity.Configurations
                     UserType = 1,
                     ConcurrencyStamp = "4af7b4cf-802a-455b-b598-997e167745b3",
                     SecurityStamp = "62549056-1b9d-46d4-84f8-adea3e4d8b68",
+                    PassportNumber = "7654321001010",
                     PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ=="// hasher.HashPassword(null, "P@ssword1")
                 }) ;
         }

+ 1 - 1
MTWorkHR.Identity/DBContext/HRIdentityDBContext.cs

@@ -1,7 +1,7 @@
 using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore;
 using MTWorkHR.Core.Entities.Base;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 
 
 namespace MTWorkHR.Identity.DBContext

+ 1 - 1
MTWorkHR.Identity/Models/ApplicationRole.cs

@@ -1,6 +1,6 @@
 using Microsoft.AspNetCore.Identity;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public class ApplicationRole : IdentityRole
     {

+ 10 - 1
MTWorkHR.Identity/Models/ApplicationUser.cs

@@ -6,15 +6,22 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public class ApplicationUser : IdentityUser
     {
         public string FirstName { get; set; }
         public string LastName { get; set; }
         public int UserType { get; set; }
+        public string? FavoriteName { get; set; }
+        public string PassportNumber { get; set; }
+        public int QualificationId { get; set; }
+        public string? University { get; set; }
+        public string? JobTitle { get; set; }
 
         public string? ManagerId { get; set; }
+        public decimal TaxNumber { get; set; }
+        public decimal IncomeTaxValue { get; set; }
 
         [ForeignKey("ManagerId")]
         public ApplicationUser Manager { get; set; }
@@ -28,6 +35,8 @@ namespace MTWorkHR.Identity.Models
         public string? DeleteUserId { get; set; }
 
         public ICollection<ApplicationRole> UserRoles { get; set; }
+        public ICollection<UserAttachment> UserAttachments { get; set; }
+        public UserAddress UserAddress { get; set; }
 
     }
 }

+ 1 - 1
MTWorkHR.Identity/Models/ApplicationUserManager.cs

@@ -7,7 +7,7 @@ using MTWorkHR.Core.Global;
 using MTWorkHR.Identity.DBContext;
 
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public class ApplicationUserManager : UserManager<ApplicationUser>
     {

+ 1 - 1
MTWorkHR.Identity/Models/IdentityExtension.cs

@@ -9,7 +9,7 @@ using System.Security.Principal;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public static class IdentityExtensions
     {

+ 1 - 1
MTWorkHR.Identity/Models/JwtSettings.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public class JwtSettingsxxx
     {

+ 1 - 1
MTWorkHR.Identity/Models/Permission.cs

@@ -1,7 +1,7 @@
 using MTWorkHR.Core.Entities.Base;
 using System.ComponentModel.DataAnnotations;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     public class Permission : Entity
     {

+ 1 - 1
MTWorkHR.Identity/Models/RolePermission.cs

@@ -6,7 +6,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Identity.Models
+namespace MTWorkHR.Identity.Entities
 {
     // This partial class to add the navigation prop ApplicationRole
     // because ApplicationRole is defined in Infrastructure.Identity and cannot be used in Core layer

+ 19 - 0
MTWorkHR.Identity/Entities/UserAddress.cs

@@ -0,0 +1,19 @@
+using MTWorkHR.Core.Entities.Base;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+
+namespace MTWorkHR.Identity.Entities
+{
+    public class UserAddress : AuditEntity
+    {
+        public string UserId { get; set; }
+
+        [ForeignKey("UserId")]
+        public ApplicationUser User { get; set; }
+
+        public int CountryId { get; set; }
+        public string City{ get; set; }
+        public string PostalCode { get; set; }
+        public string AddressDesc{ get; set; }
+    }
+}

+ 24 - 0
MTWorkHR.Identity/Entities/UserAttachment.cs

@@ -0,0 +1,24 @@
+using MTWorkHR.Core.Entities.Base;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+
+namespace MTWorkHR.Identity.Entities
+{
+    public class UserAttachment : AuditEntity
+    {
+        public string UserId { get; set; }
+
+        [ForeignKey("UserId")]
+        public ApplicationUser User { get; set; }
+        public long AttachmentTypeId { get; set; }
+
+        [ForeignKey("AttachmentTypeId")]
+        public AttachmentType AttachmentType { get; set; }
+
+        [MaxLength(250)]
+        public string FileName { get; set; }
+
+        [MaxLength(250)]
+        public string OriginalName { get; set; }
+    }
+}

+ 8 - 12
MTWorkHR.Identity/IdentityServiceRegistration.cs

@@ -4,9 +4,9 @@ using Microsoft.EntityFrameworkCore;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.IdentityModel.Tokens;
-using MTWorkHR.Core;
+using MTWorkHR.Core.Global;
 using MTWorkHR.Identity.DBContext;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -21,12 +21,10 @@ namespace MTWorkHR.Identity
         {
             services.AddSingleton(config);
 
-            // services.Configure<JwtSettings>(configuration.GetSection("JwtSettings"));
-            //var vv = config.GetSection("ConnectionString:MTWorkHRConnectionString").Value;
-            var vv = config.ConnectionStrings.MTWorkHRConnectionString;// ("ConnectionString:MTWorkHRConnectionString").Value;
+            var vv = config.ConnectionStrings.MTWorkHRConnectionString;
             services.AddDbContext<HRIdentityDBContext>(options =>
-                options.UseSqlServer(config.ConnectionStrings.MTWorkHRConnectionString
-                    //configuration.GetSection("ConnectionString:MTWorkHRConnectionString").Value
+                options.UseSqlServer(
+                    config.ConnectionStrings.MTWorkHRConnectionString  //configuration.GetSection("ConnectionString:MTWorkHRConnectionString").Value
                     ));
            
             services.AddIdentity<ApplicationUser, ApplicationRole>().AddEntityFrameworkStores<HRIdentityDBContext>().AddDefaultTokenProviders();
@@ -43,11 +41,9 @@ namespace MTWorkHR.Identity
                     ValidateAudience = true,
                     ValidateLifetime = true,
                     ClockSkew = TimeSpan.Zero,
-                //ValidIssuer = configuration["JwtSettings:Issuer"],
-                //ValidAudience = configuration["JwtSettings:Audience"],
-                ValidIssuer = config.JwtSettings.Issuer,
-                ValidAudience = config.JwtSettings.Audience,
-                IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config.JwtSettings.SecretKey))
+                    ValidIssuer = config.JwtSettings.Issuer,
+                    ValidAudience = config.JwtSettings.Audience,
+                    IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(config.JwtSettings.SecretKey))
                 }) ;
             return services;
         }

+ 18 - 18
MTWorkHR.Identity/Migrations/20240128145047_InitialCreate.Designer.cs

@@ -40,7 +40,7 @@ namespace MTWorkHR.Identity.Migrations
                     b.ToTable("ApplicationRoleApplicationUser");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
                 {
                     b.Property<string>("Id")
                         .HasColumnType("nvarchar(450)");
@@ -108,7 +108,7 @@ namespace MTWorkHR.Identity.Migrations
                         });
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
                 {
                     b.Property<string>("Id")
                         .HasColumnType("nvarchar(450)");
@@ -250,7 +250,7 @@ namespace MTWorkHR.Identity.Migrations
                         });
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.Permission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.Permission", b =>
                 {
                     b.Property<long>("Id")
                         .ValueGeneratedOnAdd()
@@ -282,7 +282,7 @@ namespace MTWorkHR.Identity.Migrations
                     b.ToTable("Permissions");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
                 {
                     b.Property<long>("Id")
                         .ValueGeneratedOnAdd()
@@ -431,37 +431,37 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("UserRolesId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UsersId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", "Manager")
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "Manager")
                         .WithMany()
                         .HasForeignKey("ManagerId");
 
                     b.Navigation("Manager");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.Permission", "Permission")
+                    b.HasOne("MTWorkHR.Identity.Entities.Permission", "Permission")
                         .WithMany()
                         .HasForeignKey("PermissionId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", "Role")
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", "Role")
                         .WithMany("RolePermissions")
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -474,7 +474,7 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -483,7 +483,7 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -492,7 +492,7 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -501,13 +501,13 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -516,14 +516,14 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
                 {
                     b.Navigation("RolePermissions");
                 });

+ 667 - 0
MTWorkHR.Identity/Migrations/20240131192843_updateUser.Designer.cs

@@ -0,0 +1,667 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Identity.DBContext;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Identity.Migrations
+{
+    [DbContext(typeof(HRIdentityDBContext))]
+    [Migration("20240131192843_updateUser")]
+    partial class updateUser
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
+                {
+                    b.Property<string>("UserRolesId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("UsersId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("UserRolesId", "UsersId");
+
+                    b.HasIndex("UsersId");
+
+                    b.ToTable("ApplicationRoleApplicationUser");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Base.AttachmentType", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<bool>("IsRequired")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("NameAr")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("NameEn")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AttachmentType");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("DeleteUserId")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool?>("IsAdmin")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("UpdateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NormalizedName")
+                        .IsUnique()
+                        .HasDatabaseName("RoleNameIndex")
+                        .HasFilter("[NormalizedName] IS NOT NULL");
+
+                    b.ToTable("AspNetRoles", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            Id = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
+                            CreateDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+                            IsAdmin = true,
+                            IsDeleted = false,
+                            Name = "Admin",
+                            NormalizedName = "ADMIN"
+                        },
+                        new
+                        {
+                            Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E",
+                            CreateDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+                            IsAdmin = false,
+                            IsDeleted = false,
+                            Name = "Employee",
+                            NormalizedName = "EMPLOYEE"
+                        });
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<int>("AccessFailedCount")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CreateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("DeleteUserId")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Email")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("EmailConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("FavoriteName")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("FirstName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<decimal>("IncomeTaxValue")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsStopped")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("JobTitle")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("LastName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("LockoutEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<DateTimeOffset?>("LockoutEnd")
+                        .HasColumnType("datetimeoffset");
+
+                    b.Property<string>("ManagerId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("NormalizedEmail")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedUserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("PassportNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("PasswordHash")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("PhoneNumber")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("PhoneNumberConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("QualificationId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SecurityStamp")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<decimal>("TaxNumber")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<bool>("TwoFactorEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("University")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UpdateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("UserType")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ManagerId");
+
+                    b.HasIndex("NormalizedEmail")
+                        .HasDatabaseName("EmailIndex");
+
+                    b.HasIndex("NormalizedUserName")
+                        .IsUnique()
+                        .HasDatabaseName("UserNameIndex")
+                        .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+                    b.ToTable("AspNetUsers", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            Id = "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                            AccessFailedCount = 0,
+                            ConcurrencyStamp = "7cc87689-9eab-4280-b8e3-1834080783a5",
+                            Email = "a@b.com",
+                            EmailConfirmed = true,
+                            FirstName = "Zinab",
+                            IncomeTaxValue = 0m,
+                            IsDeleted = false,
+                            IsStopped = false,
+                            LastName = "Elgendy",
+                            LockoutEnabled = false,
+                            NormalizedEmail = "A@B.COM",
+                            NormalizedUserName = "ADMIN",
+                            PassportNumber = "1234567",
+                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
+                            PhoneNumber = "1234567890",
+                            PhoneNumberConfirmed = true,
+                            QualificationId = 0,
+                            SecurityStamp = "49bb16c3-4704-4c60-908d-dc8506950acc",
+                            TaxNumber = 0m,
+                            TwoFactorEnabled = false,
+                            UserName = "Admin",
+                            UserType = 1
+                        },
+                        new
+                        {
+                            Id = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                            AccessFailedCount = 0,
+                            ConcurrencyStamp = "4af7b4cf-802a-455b-b598-997e167745b3",
+                            Email = "ali@b.com",
+                            EmailConfirmed = true,
+                            FirstName = "Ali",
+                            IncomeTaxValue = 0m,
+                            IsDeleted = false,
+                            IsStopped = false,
+                            LastName = "Farok",
+                            LockoutEnabled = false,
+                            NormalizedEmail = "ALI@B.COM",
+                            NormalizedUserName = "ALI",
+                            PassportNumber = "7654321001010",
+                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
+                            PhoneNumber = "1234567890",
+                            PhoneNumberConfirmed = true,
+                            QualificationId = 0,
+                            SecurityStamp = "62549056-1b9d-46d4-84f8-adea3e4d8b68",
+                            TaxNumber = 0m,
+                            TwoFactorEnabled = false,
+                            UserName = "ali",
+                            UserType = 1
+                        });
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.Permission", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CategoryName")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("Desc")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<bool>("Show")
+                        .HasColumnType("bit");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Permissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<long>("PermissionId")
+                        .HasColumnType("bigint");
+
+                    b.Property<string>("PermissionName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("RoleId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PermissionId");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("RolePermissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<long>("AttachmentTypeId")
+                        .HasColumnType("bigint");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("OriginalName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AttachmentTypeId");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("UserAttachment");
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("RoleId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetRoleClaims", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserClaims", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
+                {
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderKey")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderDisplayName")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("LoginProvider", "ProviderKey");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserLogins", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
+                {
+                    b.Property<string>("UserId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("RoleId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("UserId", "RoleId");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetUserRoles", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            UserId = "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                            RoleId = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A"
+                        },
+                        new
+                        {
+                            UserId = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                            RoleId = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E"
+                        });
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
+                {
+                    b.Property<string>("UserId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Name")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Value")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("UserId", "LoginProvider", "Name");
+
+                    b.ToTable("AspNetUserTokens", (string)null);
+                });
+
+            modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("UserRolesId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UsersId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "Manager")
+                        .WithMany()
+                        .HasForeignKey("ManagerId");
+
+                    b.Navigation("Manager");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.Permission", "Permission")
+                        .WithMany()
+                        .HasForeignKey("PermissionId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", "Role")
+                        .WithMany("RolePermissions")
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Permission");
+
+                    b.Navigation("Role");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.HasOne("MTWorkHR.Core.Entities.Base.AttachmentType", "AttachmentType")
+                        .WithMany()
+                        .HasForeignKey("AttachmentTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "User")
+                        .WithMany("UserAttachments")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AttachmentType");
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
+                {
+                    b.Navigation("RolePermissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.Navigation("UserAttachments");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 170 - 0
MTWorkHR.Identity/Migrations/20240131192843_updateUser.cs

@@ -0,0 +1,170 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Identity.Migrations
+{
+    /// <inheritdoc />
+    public partial class updateUser : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<string>(
+                name: "FavoriteName",
+                table: "AspNetUsers",
+                type: "nvarchar(max)",
+                nullable: true);
+
+            migrationBuilder.AddColumn<decimal>(
+                name: "IncomeTaxValue",
+                table: "AspNetUsers",
+                type: "decimal(18,2)",
+                nullable: false,
+                defaultValue: 0m);
+
+            migrationBuilder.AddColumn<string>(
+                name: "JobTitle",
+                table: "AspNetUsers",
+                type: "nvarchar(max)",
+                nullable: true);
+
+            migrationBuilder.AddColumn<string>(
+                name: "PassportNumber",
+                table: "AspNetUsers",
+                type: "nvarchar(max)",
+                nullable: false,
+                defaultValue: "");
+
+            migrationBuilder.AddColumn<int>(
+                name: "QualificationId",
+                table: "AspNetUsers",
+                type: "int",
+                nullable: false,
+                defaultValue: 0);
+
+            migrationBuilder.AddColumn<decimal>(
+                name: "TaxNumber",
+                table: "AspNetUsers",
+                type: "decimal(18,2)",
+                nullable: false,
+                defaultValue: 0m);
+
+            migrationBuilder.AddColumn<string>(
+                name: "University",
+                table: "AspNetUsers",
+                type: "nvarchar(max)",
+                nullable: true);
+
+            migrationBuilder.CreateTable(
+                name: "AttachmentType",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    NameAr = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
+                    NameEn = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
+                    IsRequired = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_AttachmentType", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "UserAttachment",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
+                    UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
+                    AttachmentTypeId = table.Column<long>(type: "bigint", nullable: false),
+                    FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
+                    OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_UserAttachment", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_UserAttachment_AspNetUsers_UserId",
+                        column: x => x.UserId,
+                        principalTable: "AspNetUsers",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_UserAttachment_AttachmentType_AttachmentTypeId",
+                        column: x => x.AttachmentTypeId,
+                        principalTable: "AttachmentType",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.UpdateData(
+                table: "AspNetUsers",
+                keyColumn: "Id",
+                keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                columns: new[] { "FavoriteName", "IncomeTaxValue", "JobTitle", "PassportNumber", "QualificationId", "TaxNumber", "University" },
+                values: new object[] { null, 0m, null, "1234567", 0, 0m, null });
+
+            migrationBuilder.UpdateData(
+                table: "AspNetUsers",
+                keyColumn: "Id",
+                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                columns: new[] { "FavoriteName", "IncomeTaxValue", "JobTitle", "PassportNumber", "QualificationId", "TaxNumber", "University" },
+                values: new object[] { null, 0m, null, "7654321001010", 0, 0m, null });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_UserAttachment_AttachmentTypeId",
+                table: "UserAttachment",
+                column: "AttachmentTypeId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_UserAttachment_UserId",
+                table: "UserAttachment",
+                column: "UserId");
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "UserAttachment");
+
+            migrationBuilder.DropTable(
+                name: "AttachmentType");
+
+            migrationBuilder.DropColumn(
+                name: "FavoriteName",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "IncomeTaxValue",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "JobTitle",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "PassportNumber",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "QualificationId",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "TaxNumber",
+                table: "AspNetUsers");
+
+            migrationBuilder.DropColumn(
+                name: "University",
+                table: "AspNetUsers");
+        }
+    }
+}

+ 735 - 0
MTWorkHR.Identity/Migrations/20240131193715_updateUserAddress.Designer.cs

@@ -0,0 +1,735 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Identity.DBContext;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Identity.Migrations
+{
+    [DbContext(typeof(HRIdentityDBContext))]
+    [Migration("20240131193715_updateUserAddress")]
+    partial class updateUserAddress
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
+                {
+                    b.Property<string>("UserRolesId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("UsersId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("UserRolesId", "UsersId");
+
+                    b.HasIndex("UsersId");
+
+                    b.ToTable("ApplicationRoleApplicationUser");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Base.AttachmentType", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<bool>("IsRequired")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("NameAr")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("NameEn")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AttachmentType");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("DeleteUserId")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool?>("IsAdmin")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("Name")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("UpdateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NormalizedName")
+                        .IsUnique()
+                        .HasDatabaseName("RoleNameIndex")
+                        .HasFilter("[NormalizedName] IS NOT NULL");
+
+                    b.ToTable("AspNetRoles", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            Id = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
+                            CreateDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+                            IsAdmin = true,
+                            IsDeleted = false,
+                            Name = "Admin",
+                            NormalizedName = "ADMIN"
+                        },
+                        new
+                        {
+                            Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E",
+                            CreateDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
+                            IsAdmin = false,
+                            IsDeleted = false,
+                            Name = "Employee",
+                            NormalizedName = "EMPLOYEE"
+                        });
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.Property<string>("Id")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<int>("AccessFailedCount")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConcurrencyStamp")
+                        .IsConcurrencyToken()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CreateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("DeleteUserId")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Email")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<bool>("EmailConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("FavoriteName")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("FirstName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<decimal>("IncomeTaxValue")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<bool>("IsStopped")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("JobTitle")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("LastName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("LockoutEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<DateTimeOffset?>("LockoutEnd")
+                        .HasColumnType("datetimeoffset");
+
+                    b.Property<string>("ManagerId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("NormalizedEmail")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("NormalizedUserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<string>("PassportNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("PasswordHash")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("PhoneNumber")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<bool>("PhoneNumberConfirmed")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("QualificationId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("SecurityStamp")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<decimal>("TaxNumber")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<bool>("TwoFactorEnabled")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("University")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UpdateUser")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserName")
+                        .HasMaxLength(256)
+                        .HasColumnType("nvarchar(256)");
+
+                    b.Property<int>("UserType")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ManagerId");
+
+                    b.HasIndex("NormalizedEmail")
+                        .HasDatabaseName("EmailIndex");
+
+                    b.HasIndex("NormalizedUserName")
+                        .IsUnique()
+                        .HasDatabaseName("UserNameIndex")
+                        .HasFilter("[NormalizedUserName] IS NOT NULL");
+
+                    b.ToTable("AspNetUsers", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            Id = "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                            AccessFailedCount = 0,
+                            ConcurrencyStamp = "7cc87689-9eab-4280-b8e3-1834080783a5",
+                            Email = "a@b.com",
+                            EmailConfirmed = true,
+                            FirstName = "Zinab",
+                            IncomeTaxValue = 0m,
+                            IsDeleted = false,
+                            IsStopped = false,
+                            LastName = "Elgendy",
+                            LockoutEnabled = false,
+                            NormalizedEmail = "A@B.COM",
+                            NormalizedUserName = "ADMIN",
+                            PassportNumber = "1234567",
+                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
+                            PhoneNumber = "1234567890",
+                            PhoneNumberConfirmed = true,
+                            QualificationId = 0,
+                            SecurityStamp = "49bb16c3-4704-4c60-908d-dc8506950acc",
+                            TaxNumber = 0m,
+                            TwoFactorEnabled = false,
+                            UserName = "Admin",
+                            UserType = 1
+                        },
+                        new
+                        {
+                            Id = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                            AccessFailedCount = 0,
+                            ConcurrencyStamp = "4af7b4cf-802a-455b-b598-997e167745b3",
+                            Email = "ali@b.com",
+                            EmailConfirmed = true,
+                            FirstName = "Ali",
+                            IncomeTaxValue = 0m,
+                            IsDeleted = false,
+                            IsStopped = false,
+                            LastName = "Farok",
+                            LockoutEnabled = false,
+                            NormalizedEmail = "ALI@B.COM",
+                            NormalizedUserName = "ALI",
+                            PassportNumber = "7654321001010",
+                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
+                            PhoneNumber = "1234567890",
+                            PhoneNumberConfirmed = true,
+                            QualificationId = 0,
+                            SecurityStamp = "62549056-1b9d-46d4-84f8-adea3e4d8b68",
+                            TaxNumber = 0m,
+                            TwoFactorEnabled = false,
+                            UserName = "ali",
+                            UserType = 1
+                        });
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.Permission", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CategoryName")
+                        .IsRequired()
+                        .HasMaxLength(150)
+                        .HasColumnType("nvarchar(150)");
+
+                    b.Property<string>("Desc")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<bool>("Show")
+                        .HasColumnType("bit");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Permissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<long>("PermissionId")
+                        .HasColumnType("bigint");
+
+                    b.Property<string>("PermissionName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("RoleId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("PermissionId");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("RolePermissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAddress", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("AddressDesc")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("City")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("CountryId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<string>("PostalCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId")
+                        .IsUnique();
+
+                    b.ToTable("UserAddress");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<long>("AttachmentTypeId")
+                        .HasColumnType("bigint");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("OriginalName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AttachmentTypeId");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("UserAttachment");
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("RoleId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetRoleClaims", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
+
+                    b.Property<string>("ClaimType")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ClaimValue")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserClaims", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
+                {
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderKey")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("ProviderDisplayName")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("LoginProvider", "ProviderKey");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("AspNetUserLogins", (string)null);
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
+                {
+                    b.Property<string>("UserId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("RoleId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("UserId", "RoleId");
+
+                    b.HasIndex("RoleId");
+
+                    b.ToTable("AspNetUserRoles", (string)null);
+
+                    b.HasData(
+                        new
+                        {
+                            UserId = "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
+                            RoleId = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A"
+                        },
+                        new
+                        {
+                            UserId = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
+                            RoleId = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E"
+                        });
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
+                {
+                    b.Property<string>("UserId")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("LoginProvider")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Name")
+                        .HasColumnType("nvarchar(450)");
+
+                    b.Property<string>("Value")
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("UserId", "LoginProvider", "Name");
+
+                    b.ToTable("AspNetUserTokens", (string)null);
+                });
+
+            modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("UserRolesId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UsersId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "Manager")
+                        .WithMany()
+                        .HasForeignKey("ManagerId");
+
+                    b.Navigation("Manager");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.Permission", "Permission")
+                        .WithMany()
+                        .HasForeignKey("PermissionId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", "Role")
+                        .WithMany("RolePermissions")
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Permission");
+
+                    b.Navigation("Role");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAddress", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "User")
+                        .WithOne("UserAddress")
+                        .HasForeignKey("MTWorkHR.Identity.Entities.UserAddress", "UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.HasOne("MTWorkHR.Core.Entities.Base.AttachmentType", "AttachmentType")
+                        .WithMany()
+                        .HasForeignKey("AttachmentTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "User")
+                        .WithMany("UserAttachments")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AttachmentType");
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
+                        .WithMany()
+                        .HasForeignKey("RoleId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
+                {
+                    b.Navigation("RolePermissions");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.Navigation("UserAddress")
+                        .IsRequired();
+
+                    b.Navigation("UserAttachments");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 55 - 0
MTWorkHR.Identity/Migrations/20240131193715_updateUserAddress.cs

@@ -0,0 +1,55 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Identity.Migrations
+{
+    /// <inheritdoc />
+    public partial class updateUserAddress : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "UserAddress",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
+                    UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
+                    CountryId = table.Column<int>(type: "int", nullable: false),
+                    City = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    PostalCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    AddressDesc = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_UserAddress", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_UserAddress_AspNetUsers_UserId",
+                        column: x => x.UserId,
+                        principalTable: "AspNetUsers",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateIndex(
+                name: "IX_UserAddress_UserId",
+                table: "UserAddress",
+                column: "UserId",
+                unique: true);
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "UserAddress");
+        }
+    }
+}

+ 220 - 18
MTWorkHR.Identity/Migrations/HRIdentityDBContextModelSnapshot.cs

@@ -37,7 +37,34 @@ namespace MTWorkHR.Identity.Migrations
                     b.ToTable("ApplicationRoleApplicationUser");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Base.AttachmentType", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<bool>("IsRequired")
+                        .HasColumnType("bit");
+
+                    b.Property<string>("NameAr")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("NameEn")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AttachmentType");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
                 {
                     b.Property<string>("Id")
                         .HasColumnType("nvarchar(450)");
@@ -105,7 +132,7 @@ namespace MTWorkHR.Identity.Migrations
                         });
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
                 {
                     b.Property<string>("Id")
                         .HasColumnType("nvarchar(450)");
@@ -130,16 +157,25 @@ namespace MTWorkHR.Identity.Migrations
                     b.Property<bool>("EmailConfirmed")
                         .HasColumnType("bit");
 
+                    b.Property<string>("FavoriteName")
+                        .HasColumnType("nvarchar(max)");
+
                     b.Property<string>("FirstName")
                         .IsRequired()
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<decimal>("IncomeTaxValue")
+                        .HasColumnType("decimal(18,2)");
+
                     b.Property<bool>("IsDeleted")
                         .HasColumnType("bit");
 
                     b.Property<bool>("IsStopped")
                         .HasColumnType("bit");
 
+                    b.Property<string>("JobTitle")
+                        .HasColumnType("nvarchar(max)");
+
                     b.Property<string>("LastName")
                         .IsRequired()
                         .HasColumnType("nvarchar(max)");
@@ -161,6 +197,10 @@ namespace MTWorkHR.Identity.Migrations
                         .HasMaxLength(256)
                         .HasColumnType("nvarchar(256)");
 
+                    b.Property<string>("PassportNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
                     b.Property<string>("PasswordHash")
                         .HasColumnType("nvarchar(max)");
 
@@ -170,12 +210,21 @@ namespace MTWorkHR.Identity.Migrations
                     b.Property<bool>("PhoneNumberConfirmed")
                         .HasColumnType("bit");
 
+                    b.Property<int>("QualificationId")
+                        .HasColumnType("int");
+
                     b.Property<string>("SecurityStamp")
                         .HasColumnType("nvarchar(max)");
 
+                    b.Property<decimal>("TaxNumber")
+                        .HasColumnType("decimal(18,2)");
+
                     b.Property<bool>("TwoFactorEnabled")
                         .HasColumnType("bit");
 
+                    b.Property<string>("University")
+                        .HasColumnType("nvarchar(max)");
+
                     b.Property<string>("UpdateUser")
                         .HasColumnType("nvarchar(max)");
 
@@ -209,16 +258,20 @@ namespace MTWorkHR.Identity.Migrations
                             Email = "a@b.com",
                             EmailConfirmed = true,
                             FirstName = "Zinab",
+                            IncomeTaxValue = 0m,
                             IsDeleted = false,
                             IsStopped = false,
                             LastName = "Elgendy",
                             LockoutEnabled = false,
                             NormalizedEmail = "A@B.COM",
                             NormalizedUserName = "ADMIN",
+                            PassportNumber = "1234567",
                             PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
                             PhoneNumber = "1234567890",
                             PhoneNumberConfirmed = true,
+                            QualificationId = 0,
                             SecurityStamp = "49bb16c3-4704-4c60-908d-dc8506950acc",
+                            TaxNumber = 0m,
                             TwoFactorEnabled = false,
                             UserName = "Admin",
                             UserType = 1
@@ -231,23 +284,27 @@ namespace MTWorkHR.Identity.Migrations
                             Email = "ali@b.com",
                             EmailConfirmed = true,
                             FirstName = "Ali",
+                            IncomeTaxValue = 0m,
                             IsDeleted = false,
                             IsStopped = false,
                             LastName = "Farok",
                             LockoutEnabled = false,
                             NormalizedEmail = "ALI@B.COM",
                             NormalizedUserName = "ALI",
+                            PassportNumber = "7654321001010",
                             PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
                             PhoneNumber = "1234567890",
                             PhoneNumberConfirmed = true,
+                            QualificationId = 0,
                             SecurityStamp = "62549056-1b9d-46d4-84f8-adea3e4d8b68",
+                            TaxNumber = 0m,
                             TwoFactorEnabled = false,
                             UserName = "ali",
                             UserType = 1
                         });
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.Permission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.Permission", b =>
                 {
                     b.Property<long>("Id")
                         .ValueGeneratedOnAdd()
@@ -279,7 +336,7 @@ namespace MTWorkHR.Identity.Migrations
                     b.ToTable("Permissions");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
                 {
                     b.Property<long>("Id")
                         .ValueGeneratedOnAdd()
@@ -308,6 +365,113 @@ namespace MTWorkHR.Identity.Migrations
                     b.ToTable("RolePermissions");
                 });
 
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAddress", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("AddressDesc")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("City")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<int>("CountryId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<string>("PostalCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId")
+                        .IsUnique();
+
+                    b.ToTable("UserAddress");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<long>("AttachmentTypeId")
+                        .HasColumnType("bigint");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<string>("FileName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<string>("OriginalName")
+                        .IsRequired()
+                        .HasMaxLength(250)
+                        .HasColumnType("nvarchar(250)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<string>("UserId")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(450)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AttachmentTypeId");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("UserAttachment");
+                });
+
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
                     b.Property<int>("Id")
@@ -428,37 +592,37 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("ApplicationRoleApplicationUser", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("UserRolesId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UsersId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", "Manager")
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "Manager")
                         .WithMany()
                         .HasForeignKey("ManagerId");
 
                     b.Navigation("Manager");
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.RolePermission", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.Permission", "Permission")
+                    b.HasOne("MTWorkHR.Identity.Entities.Permission", "Permission")
                         .WithMany()
                         .HasForeignKey("PermissionId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", "Role")
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", "Role")
                         .WithMany("RolePermissions")
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -469,9 +633,39 @@ namespace MTWorkHR.Identity.Migrations
                     b.Navigation("Role");
                 });
 
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAddress", b =>
+                {
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "User")
+                        .WithOne("UserAddress")
+                        .HasForeignKey("MTWorkHR.Identity.Entities.UserAddress", "UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.UserAttachment", b =>
+                {
+                    b.HasOne("MTWorkHR.Core.Entities.Base.AttachmentType", "AttachmentType")
+                        .WithMany()
+                        .HasForeignKey("AttachmentTypeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", "User")
+                        .WithMany("UserAttachments")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AttachmentType");
+
+                    b.Navigation("User");
+                });
+
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -480,7 +674,7 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -489,7 +683,7 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -498,13 +692,13 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationRole", null)
                         .WithMany()
                         .HasForeignKey("RoleId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
 
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
@@ -513,17 +707,25 @@ namespace MTWorkHR.Identity.Migrations
 
             modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                 {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
+                    b.HasOne("MTWorkHR.Identity.Entities.ApplicationUser", null)
                         .WithMany()
                         .HasForeignKey("UserId")
                         .OnDelete(DeleteBehavior.Cascade)
                         .IsRequired();
                 });
 
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>
                 {
                     b.Navigation("RolePermissions");
                 });
+
+            modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationUser", b =>
+                {
+                    b.Navigation("UserAddress")
+                        .IsRequired();
+
+                    b.Navigation("UserAttachments");
+                });
 #pragma warning restore 612, 618
         }
     }

+ 1 - 0
MTWorkHR.Infrastructure/Data/HRDataContext.cs

@@ -14,6 +14,7 @@ namespace MTWorkHR.Infrastructure.Data
     {
         public HRDataContext(DbContextOptions<HRDataContext> options) : base(options) { }
 
+        public DbSet<Company> Companies { get; set; }
 
         protected override void OnModelCreating(ModelBuilder modelBuilder)
         {

+ 1 - 1
MTWorkHR.Infrastructure/EmailService/EmailSender.cs

@@ -3,7 +3,7 @@ using Microsoft.Extensions.Options;
 using MimeKit;
 using MTWorkHR.Application.Models.Email;
 using MTWorkHR.Application.Services;
-using MTWorkHR.Core;
+using MTWorkHR.Core.Global;
 using SendGrid;
 using SendGrid.Helpers.Mail;
 using System;

+ 30 - 3
MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs

@@ -5,15 +5,42 @@ using MTWorkHR.Infrastructure.EmailService;
 using MTWorkHR.Application.Logging;
 using MTWorkHR.Infrastructure.Logging;
 using MTWorkHR.Application.Services;
-using MTWorkHR.Core;
+using MTWorkHR.Core.Global;
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore;
+using MTWorkHR.Core.IRepositories.Base;
+using MTWorkHR.Core.IRepositories;
+using MTWorkHR.Core.UnitOfWork;
+using MTWorkHR.Identity.Entities;
+using MTWorkHR.Infrastructure.Data;
+using MTWorkHR.Infrastructure.Repositories;
+using MTWorkHR.Infrastructure.UnitOfWorks;
 
 
 namespace MTWorkHR.Infrastructure
 {
     public static class InfrastructureServiceRegistration
     {
-        public static IServiceCollection AddInfrastructureServices (this IServiceCollection services, IConfiguration configuration){
-            services.Configure<EmailSettings>(configuration.GetSection("MailSettings"));
+        public static IServiceCollection AddInfrastructureServices (this IServiceCollection services, AppSettingsConfiguration configuration){
+            services.AddDbContext<HRDataContext>(options => {
+                options.UseSqlServer(configuration.ConnectionStrings.MTWorkHRConnectionString);
+            });
+
+            services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
+            services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>));
+            services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository));
+            services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository));
+            services.AddScoped(typeof(IRolePermissionRepository<RolePermission>), typeof(RolePermissionRepository));
+            services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));
+
+            services.AddScoped<IUnitOfWork, UnitOfWork>();
+            services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
+
+            services.AddScoped<ApplicationUserManager>();
+            services.AddScoped<GlobalInfo>();
+
+            services.AddScoped<IEmployeeRepository, EmployeeRepository>();
+
             services.AddTransient<IEmailSender, EmailSender>();
             services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
             return services;

+ 79 - 0
MTWorkHR.Infrastructure/Migrations/20240131192339_addCompany.Designer.cs

@@ -0,0 +1,79 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Infrastructure.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(HRDataContext))]
+    [Migration("20240131192339_addCompany")]
+    partial class addCompany
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Company", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CRNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CompanyName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("TaxNumber")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<long>("UserId")
+                        .HasColumnType("bigint");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Companies");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 43 - 0
MTWorkHR.Infrastructure/Migrations/20240131192339_addCompany.cs

@@ -0,0 +1,43 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    /// <inheritdoc />
+    public partial class addCompany : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "Companies",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
+                    UserId = table.Column<long>(type: "bigint", nullable: false),
+                    CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CRNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    TaxNumber = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
+                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Companies", x => x.Id);
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "Companies");
+        }
+    }
+}

+ 76 - 0
MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs

@@ -0,0 +1,76 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Infrastructure.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(HRDataContext))]
+    partial class HRDataContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Company", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CRNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CompanyName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<decimal>("TaxNumber")
+                        .HasColumnType("decimal(18,2)");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<long>("UserId")
+                        .HasColumnType("bigint");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Companies");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 17 - 17
MTWorkHR.Infrastructure/PersistenceServiceRegistration.cs

@@ -5,7 +5,7 @@ using Microsoft.Extensions.Configuration;
 using MTWorkHR.Core.IRepositories.Base;
 using MTWorkHR.Infrastructure.Repositories;
 using MTWorkHR.Core.IRepositories;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using Microsoft.AspNetCore.Identity;
 using MTWorkHR.Core.UnitOfWork;
 using MTWorkHR.Infrastructure.UnitOfWorks;
@@ -16,27 +16,27 @@ namespace MTWorkHR.Infrastructure
 {
     public static class PersistenceServiceRegistration
     {
-        public static IServiceCollection AddPersistenceServices (this IServiceCollection services, IConfiguration configuration){
-            services.AddDbContext<HRDataContext>(options => {
-                options.UseSqlServer(configuration.GetSection("ConnectionStrings:MTWorkHRConnectionString").Value);
-            });
+        public static IServiceCollection AddPersistenceServices2 (this IServiceCollection services, AppSettingsConfiguration configuration)
+        {
+            //services.AddDbContext<HRDataContext>(options => {
+            //    options.UseSqlServer(configuration.ConnectionStrings.MTWorkHRConnectionString);
+            //});
 
-            services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
-            services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>));
+            //services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
+            //services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>));
 
-            services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository));
-            services.AddScoped(typeof(IRolePermissionRepository<RolePermission>), typeof(RolePermissionRepository));
-            services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));
+            //services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository));
+            //services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository));
+            //services.AddScoped(typeof(IRolePermissionRepository<RolePermission>), typeof(RolePermissionRepository));
+            //services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));
 
-            services.AddScoped<IUnitOfWork, UnitOfWork>();
-            services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
+            //services.AddScoped<IUnitOfWork, UnitOfWork>();
+            //services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
 
-            services.AddScoped<ApplicationUserManager>();
-            services.AddScoped<GlobalInfo>();
+            //services.AddScoped<ApplicationUserManager>();
+            //services.AddScoped<GlobalInfo>();
 
-
-
-            services.AddScoped<IEmployeeRepository, EmployeeRepository>();
+            //services.AddScoped<IEmployeeRepository, EmployeeRepository>();
             return services;
         }
     }

+ 1 - 1
MTWorkHR.Infrastructure/Repositories/Auth/RolePermissionRepository.cs

@@ -2,7 +2,7 @@
 using MTWorkHR.Core.Entities.Base;
 using MTWorkHR.Core.IDto;
 using MTWorkHR.Core.IRepositories;
-using MTWorkHR.Identity.Models;
+using MTWorkHR.Identity.Entities;
 using MTWorkHR.Infrastructure.Data;
 using System;
 using System.Collections.Generic;

+ 0 - 5
MTWorkHR.Infrastructure/Repositories/Auth/UserRoleRepository.cs

@@ -4,11 +4,6 @@ using MTWorkHR.Core.Entities.Base;
 using MTWorkHR.Core.IDto;
 using MTWorkHR.Core.IRepositories;
 using MTWorkHR.Identity.DBContext;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace MTWorkHR.Infrastructure.Repositories
 {

+ 17 - 0
MTWorkHR.Infrastructure/Repositories/User/CompanyRepository.cs

@@ -0,0 +1,17 @@
+using Microsoft.EntityFrameworkCore;
+using MTWorkHR.Core.Entities;
+using MTWorkHR.Core.IDto;
+using MTWorkHR.Core.IRepositories;
+using MTWorkHR.Identity.Entities;
+using MTWorkHR.Infrastructure.Data;
+
+namespace MTWorkHR.Infrastructure.Repositories
+{
+    public class CompanyRepository : Repository<Company>, ICompanyRepository
+    {
+        public CompanyRepository(HRDataContext context) : base(context)
+        {
+        }
+
+    }
+}

+ 6 - 1
MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs

@@ -3,6 +3,9 @@ using MTWorkHR.Core.UnitOfWork;
 using MTWorkHR.Infrastructure.Data;
 using MTWorkHR.Core.IRepositories;
 using MTWorkHR.Core.Global;
+using MTWorkHR.Infrastructure.Repositories;
+using MTWorkHR.Core.IRepositories.Base;
+using MTWorkHR.Identity.Entities;
 
 namespace MTWorkHR.Infrastructure.UnitOfWorks
 {
@@ -11,16 +14,18 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
         private readonly HRDataContext context;
 
         public IPermissionRepository Permission { get; }
+        public ICompanyRepository Company { get; }
 
 
         public UnitOfWork(HRDataContext _context
             , IPermissionRepository Permission
-
+            , ICompanyRepository Company
             )
         {
             context = _context;
 
             this.Permission = Permission;
+            this.Company = Company;
 		}
 
         public async Task<int> CompleteAsync()