Selaa lähdekoodia

Add ResetPass

zinab 9 kuukautta sitten
vanhempi
commit
8a54c851f9
23 muutettua tiedostoa jossa 320 lisäystä ja 2646 poistoa
  1. 32 4
      MTWorkHR.API/Controllers/AuthController.cs
  2. 2 6
      MTWorkHR.API/Controllers/UserController.cs
  3. 2 1
      MTWorkHR.Application/Identity/IAuthService.cs
  4. 4 2
      MTWorkHR.Application/Identity/IUserService.cs
  5. 1 0
      MTWorkHR.Application/Models/Identity/AuthResponse.cs
  6. 0 1
      MTWorkHR.Application/Models/Identity/ForgetPasswordDto.cs
  7. 15 0
      MTWorkHR.Application/Models/Identity/LoginDto.cs
  8. 9 2
      MTWorkHR.Application/Models/Identity/UserDto.cs
  9. 38 33
      MTWorkHR.Application/Services/Auth/AuthService.cs
  10. 81 12
      MTWorkHR.Application/Services/Auth/UserService.cs
  11. 1 1
      MTWorkHR.Identity/IdentityServiceRegistration.cs
  12. 0 4
      MTWorkHR.Identity/MTWorkHR.Identity.csproj
  13. 0 353
      MTWorkHR.Identity/Migrations/20240115092554_identity.Designer.cs
  14. 0 546
      MTWorkHR.Identity/Migrations/20240122162044_altrIdentity.Designer.cs
  15. 0 350
      MTWorkHR.Identity/Migrations/20240122162044_altrIdentity.cs
  16. 0 546
      MTWorkHR.Identity/Migrations/20240124091904_altrIdentity2.Designer.cs
  17. 0 46
      MTWorkHR.Identity/Migrations/20240124091904_altrIdentity2.cs
  18. 0 533
      MTWorkHR.Identity/Migrations/20240124093416_altrIdentity3.Designer.cs
  19. 0 142
      MTWorkHR.Identity/Migrations/20240124093416_altrIdentity3.cs
  20. 0 46
      MTWorkHR.Identity/Migrations/20240124094323_altrIdentity4.cs
  21. 2 2
      MTWorkHR.Identity/Migrations/20240124094323_altrIdentity4.Designer.cs
  22. 125 10
      MTWorkHR.Identity/Migrations/20240115092554_identity.cs
  23. 8 6
      MTWorkHR.Infrastructure/EmailService/EmailSender.cs

+ 32 - 4
MTWorkHR.API/Controllers/AuthController.cs

@@ -1,7 +1,9 @@
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
+using MTWorkHR.Application.Filters;
 using MTWorkHR.Application.Identity;
 using MTWorkHR.Application.Models;
+using MTWorkHR.Identity.Services;
 
 namespace MTWorkHR.API.Controllers
 {
@@ -10,9 +12,11 @@ namespace MTWorkHR.API.Controllers
     public class AuthController : ControllerBase
     {
         private readonly IAuthService _authenticationService;
-        public AuthController(IAuthService authenticationService) 
+        private readonly IUserService _userService;
+        public AuthController(IAuthService authenticationService, IUserService userService) 
         {
-            this._authenticationService = authenticationService;
+            _authenticationService = authenticationService;
+            _userService = userService;
         }
         [HttpPost("login")]
         public async Task<ActionResult<AuthResponse>> Login(AuthRequest request)
@@ -20,9 +24,33 @@ namespace MTWorkHR.API.Controllers
             return Ok( await _authenticationService.Login(request));
         }
         [HttpPost("register")]
-        public async Task<ActionResult<RegistrationResponse>> Register(RegistrationRequest request)
+        public async Task<ActionResult<UserDto>> Register([FromBody] UserDto input)
         {
-            return Ok(await _authenticationService.Register(request));
+            return await _userService.Create(input);
         }
+
+      
+        [HttpPost("IsExpiredToken")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+        public async Task<bool> IsExpiredToken([FromBody] ForgetPasswordDto model)
+        {
+            return await _userService.IsExpiredToken(model);
+        }
+
+        [HttpPost("forgetPasswordMail")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+        public async Task ForgetPasswordMail(string userId)
+        {
+            await _userService.ForgetPasswordMail(userId);
+        }
+
+        [HttpPost("forgetPassword")]
+        [ProducesResponseType(StatusCodes.Status200OK)]
+        public async Task<bool> ForgetPassword([FromBody] ForgetPasswordDto model)
+        {
+            return await _userService.ForgetPassword(model);
+        }
+       
+        
     }
 }

+ 2 - 6
MTWorkHR.API/Controllers/UserController.cs

@@ -1,4 +1,5 @@
 using Microsoft.AspNetCore.Authorization;
+
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using MTWorkHR.Application.Identity;
@@ -59,11 +60,6 @@ namespace MTWorkHR.API.Controllers
         }
 
 
-        [HttpPost("ForgetPassword")]
-        [ProducesResponseType(StatusCodes.Status200OK)]
-        public async Task ForgetPassword(string input)
-        {
-            await _userService.ForgetPassword(input);
-        }
+       
     }
 }

+ 2 - 1
MTWorkHR.Application/Identity/IAuthService.cs

@@ -10,6 +10,7 @@ namespace MTWorkHR.Application.Identity
     public interface IAuthService
     {
         Task<AuthResponse> Login(AuthRequest request);
-        Task<RegistrationResponse> Register(RegistrationRequest request);
+
+
     }
 }

+ 4 - 2
MTWorkHR.Application/Identity/IUserService.cs

@@ -17,8 +17,10 @@ namespace MTWorkHR.Application.Identity
         Task<UserDto> Create(UserDto input);
         Task<UserDto> Update(UserDto input);
         Task<UserDto> UpdateWithoutChildren(UserDto input);
-        Task ForgetPassword(string input);
-        Task<bool> ConfirmForgetPassword(ForgetPasswordDto input);
+        Task ForgetPasswordMail(string input);
         Task<bool> ResetPassword(ResetPasswordDto input);
+
+        Task<bool> ForgetPassword(ForgetPasswordDto model);
+        Task<bool> IsExpiredToken(ForgetPasswordDto model);
     }
 }

+ 1 - 0
MTWorkHR.Application/Models/Identity/AuthResponse.cs

@@ -12,5 +12,6 @@ namespace MTWorkHR.Application.Models
         public string UserName { get; set; }
         public string Email { get; set; }
         public string Token{ get; set; }
+        public DateTime Expiration { get; set; }
     }
 }

+ 0 - 1
MTWorkHR.Application/Models/Identity/ForgetPasswordDto.cs

@@ -10,6 +10,5 @@ namespace MTWorkHR.Application.Models
         public string Token { get; set; }
         
         public string Password { get; set; }
-        public string OTP { get; set; }
     }
 }

+ 15 - 0
MTWorkHR.Application/Models/Identity/LoginDto.cs

@@ -0,0 +1,15 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace MTWorkHR.Application.Models
+{
+    public class LoginDto
+    {
+        public string? Tenant { get; set; }
+
+        [Required(ErrorMessage = "User Name is required")]
+        public string UserName { get; set; }
+
+        [Required(ErrorMessage = "Password is required")]
+        public string Password { get; set; }
+    }
+}

+ 9 - 2
MTWorkHR.Application/Models/Identity/UserDto.cs

@@ -1,6 +1,7 @@
 using MTWorkHR.Core.Global;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -9,15 +10,21 @@ namespace MTWorkHR.Application.Models
 {
     public class UserDto
     {
-        public string Id { get; set; }
+        public string? Id { get; set; }
+        [Required]
+        [EmailAddress]
         public string Email { get; set; }
+        [Required]
         public string FirstName { get; set; } 
         public string LastName { get; set; }
         public string PhoneNumber { get; set; }
         public string LinkedInLink { get; set; }
+        [Required]
         public UserTypeEnum UserType { get; set; }
+        [Required]
+        [MinLength(6)]
         public string UserName { get; set; }
-
+        public string Password { get; set; }
         public IList<UserRoleDto>? UserRoles { get; set; }
     }
 }

+ 38 - 33
MTWorkHR.Application/Services/Auth/AuthService.cs

@@ -16,12 +16,12 @@ namespace MTWorkHR.Identity.Services
     {
         private readonly UserManager<ApplicationUser> _userManager;
         private readonly SignInManager<ApplicationUser> _signInManager;
-        private readonly JwtSettings _jwtSettings;
-        public AuthService(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, IOptions<JwtSettings>jwtSettings) 
+        private readonly AppSettingsConfiguration _configuration;
+        public AuthService(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, AppSettingsConfiguration configuration) 
         {
             _userManager = userManager;
             _signInManager = signInManager;
-            _jwtSettings = jwtSettings.Value;
+            _configuration = configuration;
         }
         public async Task<AuthResponse> Login(AuthRequest request)
         {
@@ -41,35 +41,39 @@ namespace MTWorkHR.Identity.Services
                 Id = user.Id,
                 Email = user.Email,
                 UserName = user.UserName,
-                Token = new JwtSecurityTokenHandler().WriteToken( jwtToken)
+                Token = new JwtSecurityTokenHandler().WriteToken( jwtToken),
+                Expiration = jwtToken.ValidTo
             };
             return response;
         }
-        public async Task<RegistrationResponse> Register(RegistrationRequest request)
-        {
-            var user = new ApplicationUser { 
-                Email = request.Email ,
-                UserName = request.UserName ,
-                FirstName = request.FirstName ,
-                LastName = request.LastName ,
-                EmailConfirmed  = true
-            };
-            var result = await _userManager.CreateAsync(user, request.Password);
-            if (result.Succeeded)
-            {
-                await _userManager.AddToRoleAsync(user, request.RoleName);
-                return new RegistrationResponse(){ UserId = user.Id };
-            }
-            else
-            {
-                StringBuilder str = new StringBuilder();
-                foreach (var err in result.Errors)
-                {
-                    str.AppendFormat(".{0}\n", err.Description);
-                }
-                throw new BadRequest($"{str}");
-            }
-        }
+        //public async Task<RegistrationResponse> Register(RegistrationRequest request)
+        //{
+        //    var user = new ApplicationUser { 
+        //        Email = request.Email ,
+        //        UserName = request.UserName ,
+        //        FirstName = request.FirstName ,
+        //        LastName = request.LastName ,
+        //        EmailConfirmed  = true
+        //    };
+        //    var result = await _userManager.CreateAsync(user, request.Password);
+        //    if (result.Succeeded)
+        //    {
+        //        await _userManager.AddToRoleAsync(user, request.RoleName);
+        //        return new RegistrationResponse(){ UserId = user.Id };
+        //    }
+        //    else
+        //    {
+        //        StringBuilder str = new StringBuilder();
+        //        foreach (var err in result.Errors)
+        //        {
+        //            str.AppendFormat(".{0}\n", err.Description);
+        //        }
+        //        throw new BadRequest($"{str}");
+        //    }
+        //}
+
+      
+
         private async Task<JwtSecurityToken> GenerateToken(ApplicationUser user)
         {
             var userCalims = await _userManager.GetClaimsAsync(user);
@@ -83,13 +87,13 @@ namespace MTWorkHR.Identity.Services
                 new Claim("uid", user.Id)
             }.Union(userCalims)
             .Union(roleClaims);
-            var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtSettings.SecretKey));
+            var symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_configuration.JwtSettings.SecretKey));
             var signingCredentials = new SigningCredentials(symmetricSecurityKey, SecurityAlgorithms.HmacSha256);
             var jwtSecurityToken = new JwtSecurityToken(
-                issuer: _jwtSettings.Issuer,
-                audience: _jwtSettings.Audience,
+                issuer: _configuration.JwtSettings.Issuer,
+                audience: _configuration.JwtSettings.Audience,
                 claims: claims,
-                expires: DateTime.Now.AddMinutes(_jwtSettings.DurationInMinutes),
+                expires: DateTime.Now.AddMinutes(_configuration.JwtSettings.DurationInMinutes),
                 signingCredentials: signingCredentials
                 );
             return jwtSecurityToken;
@@ -97,4 +101,5 @@ namespace MTWorkHR.Identity.Services
 
        
     }
+  
 }

+ 81 - 12
MTWorkHR.Application/Services/Auth/UserService.cs

@@ -17,6 +17,10 @@ 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;
+using System.Security.Policy;
 
 namespace MTWorkHR.Identity.Services
 {
@@ -28,8 +32,10 @@ namespace MTWorkHR.Identity.Services
         private readonly IUserRoleRepository<IdentityUserRole<string>> _userRole;
         private readonly AppSettingsConfiguration _configuration;
         private readonly IEmailSender _emailSender;
+        private readonly GlobalInfo _globalInfo;
+
         public UserService(ApplicationUserManager userManager, IUnitOfWork unitOfWork
-             , RoleManager<ApplicationRole> roleManager, AppSettingsConfiguration configuration, IEmailSender emailSender
+             , RoleManager<ApplicationRole> roleManager, GlobalInfo globalInfo, AppSettingsConfiguration configuration, IEmailSender emailSender
             , IUserRoleRepository<IdentityUserRole<string>> userRole)
         {
             _userManager = userManager;
@@ -38,6 +44,7 @@ namespace MTWorkHR.Identity.Services
             _userRole = userRole;
             _configuration = configuration;
             _emailSender = emailSender;
+            _globalInfo = globalInfo;
         }
         public async Task<UserDto> GetById(string userId)
         {
@@ -113,13 +120,13 @@ namespace MTWorkHR.Identity.Services
             _unitOfWork.CommitTran();
             try
             {
-                string url = await GetResetPasswordURL(user.Id);
+                var resultPassReset = await GetResetPasswordURL(user.Id);
 
                 var sendMailResult = await _emailSender.SendEmail(new EmailMessage {
                     Subject = "Register Confirmation",
                     To = input.Email,  
                     Body =  "Please Set Your Password (this link will expired after 24 hours)"
-                    , url = url, userId = user.Id } );
+                    , url = resultPassReset.Item1, userId = user.Id } );
                 if (!sendMailResult)
                 {
                     throw new AppException("User created, but could not send the email!");
@@ -132,19 +139,19 @@ namespace MTWorkHR.Identity.Services
 
             return input;
         }
-        private async Task<string> GetResetPasswordURL(string userId)
+        private async Task<Tuple< string, string>> GetResetPasswordURL(string userId)
         {
             var user = await _userManager.Users.FirstOrDefaultAsync(x => (!x.IsDeleted) && x.Id.Equals(userId));
             if (user == null)
                 throw new AppException(ExceptionEnum.RecordNotExist);
 
             string code = await _userManager.GeneratePasswordResetTokenAsync(user);
-            var route = "login/forgetpassword";
+            var route = "auth/forgetpassword";
             var origin = _configuration.JwtSettings.Audience;
             var endpointUri = new Uri(string.Concat($"{origin}/", route));
             var userURL = QueryHelpers.AddQueryString(endpointUri.ToString(), "userId", user.Id);
             var passwordResetURL = QueryHelpers.AddQueryString(userURL.ToString(), "token", code);
-            return passwordResetURL;
+            return new Tuple <string, string> ( passwordResetURL, user.Email);
         }
         public Task<UserDto> Update(UserDto input)
         {
@@ -156,19 +163,81 @@ namespace MTWorkHR.Identity.Services
             throw new NotImplementedException();
         }
 
-        public Task ForgetPassword(string input)
+        public async Task<bool> IsExpiredToken(ForgetPasswordDto input)
         {
-            throw new NotImplementedException();
+            var user = await _userManager.Users.IgnoreQueryFilters().FirstOrDefaultAsync(x => x.Id == input.UserId);
+            if (user == null)
+                throw new AppException(ExceptionEnum.RecordNotExist);
+            var purpose = UserManager<ApplicationUser>.ResetPasswordTokenPurpose;
+            var result = await _userManager.VerifyUserTokenAsync(user, "Default", purpose, input.Token);
+            return !result;
+        }
+        public async Task<bool> ForgetPassword(ForgetPasswordDto model)
+        {
+            var user = await _userManager.Users.IgnoreQueryFilters().FirstOrDefaultAsync(x => x.Id == model.UserId);
+            if (user == null)
+                throw new AppException(ExceptionEnum.RecordNotExist);
+
+            var result = await _userManager.ResetPasswordAsync(user, model.Token, model.Password);
+            return result.Succeeded;
         }
 
-        public Task<bool> ConfirmForgetPassword(ForgetPasswordDto input)
+        public async Task<bool> ResetPassword(ResetPasswordDto input)
         {
-            throw new NotImplementedException();
+            var user = await _userManager.FindByIdAsync(_globalInfo.UserId);
+
+            if (user == null)
+                throw new AppException(ExceptionEnum.RecordNotExist);
+
+            if (!await _userManager.CheckPasswordAsync(user, input.OldPassword))
+                throw new AppException(ExceptionEnum.WrongCredentials);
+
+            var token = await _userManager.GeneratePasswordResetTokenAsync(user);
+
+            var result = await _userManager.ResetPasswordAsync(user, token, input.NewPassword);
+            if (!result.Succeeded)
+                throw new AppException(ExceptionEnum.RecordUpdateFailed);
+
+            return true;
+        }
+        public async Task ForgetPasswordMail(string userId)
+        {
+            var resultPassReset = await GetResetPasswordURL(userId);
+
+            await _emailSender.SendEmail(new EmailMessage
+            {
+                Subject = "Register Confirmation",
+                To = resultPassReset.Item2,
+                Body = "Forget Your Password, link will expired after 24 hours",
+                url = resultPassReset.Item1,
+                userId = userId
+            });
+            
         }
 
-        public Task<bool> ResetPassword(ResetPasswordDto input)
+        public async Task StopUser(string userId)
         {
-            throw new NotImplementedException();
+            var entity = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == userId);
+            if (entity == null)
+                throw new AppException(ExceptionEnum.RecordNotExist);
+            if (!entity.IsStopped)
+            {
+                entity.IsStopped = true;
+                await _unitOfWork.CompleteAsync();
+            }
+        }
+        public async Task ActiveUser(string userId)
+        {
+            var entity = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == userId);
+            if (entity == null)
+                throw new AppException(ExceptionEnum.RecordNotExist);
+
+            entity.IsStopped = false;
+            entity.AccessFailedCount = 0;
+            entity.LockoutEnabled = false;
+            entity.LockoutEnd = null;
+            await _unitOfWork.CompleteAsync();
+
         }
     }
 }

+ 1 - 1
MTWorkHR.Identity/IdentityServiceRegistration.cs

@@ -28,7 +28,7 @@ namespace MTWorkHR.Identity
                 options.UseSqlServer(config.ConnectionStrings.MTWorkHRConnectionString
                     //configuration.GetSection("ConnectionString:MTWorkHRConnectionString").Value
                     ));
-
+           
             services.AddIdentity<ApplicationUser, ApplicationRole>().AddEntityFrameworkStores<HRIdentityDBContext>().AddDefaultTokenProviders();
 
            

+ 0 - 4
MTWorkHR.Identity/MTWorkHR.Identity.csproj

@@ -19,10 +19,6 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Folder Include="Services\Auth\" />
-  </ItemGroup>
-
-  <ItemGroup>
     <ProjectReference Include="..\MTWorkHR.Core\MTWorkHR.Core.csproj" />
   </ItemGroup>
 

+ 0 - 353
MTWorkHR.Identity/Migrations/20240115092554_identity.Designer.cs

@@ -1,353 +0,0 @@
-// <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("20240115092554_identity")]
-    partial class identity
-    {
-        /// <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.Identity.Models.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>("Email")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    b.Property<bool>("EmailConfirmed")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("FirstName")
-                        .IsRequired()
-                        .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>("NormalizedEmail")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    b.Property<string>("NormalizedUserName")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    b.Property<string>("PasswordHash")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("PhoneNumber")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("PhoneNumberConfirmed")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("SecurityStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("TwoFactorEnabled")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("UserName")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    b.HasKey("Id");
-
-                    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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "d1e41737-1312-47fe-b7e9-fa9917dd94ad",
-                            Email = "a@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Zinab",
-                            LastName = "Elgendy",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "A@B.COM",
-                            NormalizedUserName = "ADMIN",
-                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "7714198f-15f6-4524-a221-b0826892516b",
-                            TwoFactorEnabled = false,
-                            UserName = "Admin"
-                        },
-                        new
-                        {
-                            Id = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "fe634cad-b63a-4cc1-8938-4499edd22d35",
-                            Email = "ali@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Ali",
-                            LastName = "Farok",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "ALI@B.COM",
-                            NormalizedUserName = "ALI",
-                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "bba3264c-1777-4ca7-837a-2f8ed1b16d01",
-                            TwoFactorEnabled = false,
-                            UserName = "ali"
-                        });
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
-                {
-                    b.Property<string>("Id")
-                        .HasColumnType("nvarchar(450)");
-
-                    b.Property<string>("ConcurrencyStamp")
-                        .IsConcurrencyToken()
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Name")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    b.Property<string>("NormalizedName")
-                        .HasMaxLength(256)
-                        .HasColumnType("nvarchar(256)");
-
-                    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-F9FAEF1F211B",
-                            Name = "Admin",
-                            NormalizedName = "ADMIN"
-                        },
-                        new
-                        {
-                            Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
-                            Name = "Employee",
-                            NormalizedName = "EMPLOYEE"
-                        });
-                });
-
-            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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            RoleId = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B"
-                        },
-                        new
-                        {
-                            UserId = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            RoleId = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A"
-                        });
-                });
-
-            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("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
-                {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
-                {
-                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 0 - 546
MTWorkHR.Identity/Migrations/20240122162044_altrIdentity.Designer.cs

@@ -1,546 +0,0 @@
-// <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("20240122162044_altrIdentity")]
-    partial class altrIdentity
-    {
-        /// <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.Identity.Models.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);
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.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>("FirstName")
-                        .IsRequired()
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("IsDeleted")
-                        .HasColumnType("bit");
-
-                    b.Property<bool>("IsStopped")
-                        .HasColumnType("bit");
-
-                    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>("PasswordHash")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("PhoneNumber")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("PhoneNumberConfirmed")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("SecurityStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("TwoFactorEnabled")
-                        .HasColumnType("bit");
-
-                    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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "b6b32734-b83c-4619-8de6-6e0e48cea904",
-                            Email = "a@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Zinab",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Elgendy",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "A@B.COM",
-                            NormalizedUserName = "ADMIN",
-                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "2ec2e41b-9f51-4779-9687-4cef7afd2c98",
-                            TwoFactorEnabled = false,
-                            UserName = "Admin",
-                            UserType = 1
-                        },
-                        new
-                        {
-                            Id = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "f3684ce0-8dc7-4f91-b317-b6a7d8d55011",
-                            Email = "ali@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Ali",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Farok",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "ALI@B.COM",
-                            NormalizedUserName = "ALI",
-                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "50a3c8b2-93bf-41b3-bf7f-d2240d8b7386",
-                            TwoFactorEnabled = false,
-                            UserName = "ali",
-                            UserType = 1
-                        });
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.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.Models.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("Microsoft.AspNetCore.Identity.IdentityRole", b =>
-                {
-                    b.Property<string>("Id")
-                        .HasColumnType("nvarchar(450)");
-
-                    b.Property<string>("ConcurrencyStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("NormalizedName")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("IdentityRole");
-
-                    b.HasData(
-                        new
-                        {
-                            Id = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B",
-                            Name = "Admin",
-                            NormalizedName = "ADMIN"
-                        },
-                        new
-                        {
-                            Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
-                            Name = "Employee",
-                            NormalizedName = "EMPLOYEE"
-                        });
-                });
-
-            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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            RoleId = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B"
-                        },
-                        new
-                        {
-                            UserId = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            RoleId = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A"
-                        });
-                });
-
-            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.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("UserRolesId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UsersId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", "Manager")
-                        .WithMany()
-                        .HasForeignKey("ManagerId");
-
-                    b.Navigation("Manager");
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.Permission", "Permission")
-                        .WithMany()
-                        .HasForeignKey("PermissionId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", "Role")
-                        .WithMany("RolePermissions")
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.Navigation("Permission");
-
-                    b.Navigation("Role");
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
-                {
-                    b.Navigation("RolePermissions");
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 0 - 350
MTWorkHR.Identity/Migrations/20240122162044_altrIdentity.cs

@@ -1,350 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
-
-namespace MTWorkHR.Identity.Migrations
-{
-    /// <inheritdoc />
-    public partial class altrIdentity : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DeleteData(
-                table: "AspNetRoles",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetRoles",
-                keyColumn: "Id",
-                keyValue: "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A");
-
-            migrationBuilder.AddColumn<string>(
-                name: "CreateUser",
-                table: "AspNetUsers",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<string>(
-                name: "DeleteUserId",
-                table: "AspNetUsers",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<bool>(
-                name: "IsDeleted",
-                table: "AspNetUsers",
-                type: "bit",
-                nullable: false,
-                defaultValue: false);
-
-            migrationBuilder.AddColumn<bool>(
-                name: "IsStopped",
-                table: "AspNetUsers",
-                type: "bit",
-                nullable: false,
-                defaultValue: false);
-
-            migrationBuilder.AddColumn<string>(
-                name: "ManagerId",
-                table: "AspNetUsers",
-                type: "nvarchar(450)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<string>(
-                name: "UpdateUser",
-                table: "AspNetUsers",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<int>(
-                name: "UserType",
-                table: "AspNetUsers",
-                type: "int",
-                nullable: false,
-                defaultValue: 0);
-
-            migrationBuilder.AddColumn<DateTime>(
-                name: "CreateDate",
-                table: "AspNetRoles",
-                type: "datetime2",
-                nullable: false,
-                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
-
-            migrationBuilder.AddColumn<string>(
-                name: "CreateUser",
-                table: "AspNetRoles",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<string>(
-                name: "DeleteUserId",
-                table: "AspNetRoles",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.AddColumn<bool>(
-                name: "IsAdmin",
-                table: "AspNetRoles",
-                type: "bit",
-                nullable: true);
-
-            migrationBuilder.AddColumn<bool>(
-                name: "IsDeleted",
-                table: "AspNetRoles",
-                type: "bit",
-                nullable: false,
-                defaultValue: false);
-
-            migrationBuilder.AddColumn<DateTime>(
-                name: "UpdateDate",
-                table: "AspNetRoles",
-                type: "datetime2",
-                nullable: true);
-
-            migrationBuilder.AddColumn<string>(
-                name: "UpdateUser",
-                table: "AspNetRoles",
-                type: "nvarchar(max)",
-                nullable: true);
-
-            migrationBuilder.CreateTable(
-                name: "ApplicationRoleApplicationUser",
-                columns: table => new
-                {
-                    UserRolesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
-                    UsersId = table.Column<string>(type: "nvarchar(450)", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_ApplicationRoleApplicationUser", x => new { x.UserRolesId, x.UsersId });
-                    table.ForeignKey(
-                        name: "FK_ApplicationRoleApplicationUser_AspNetRoles_UserRolesId",
-                        column: x => x.UserRolesId,
-                        principalTable: "AspNetRoles",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                    table.ForeignKey(
-                        name: "FK_ApplicationRoleApplicationUser_AspNetUsers_UsersId",
-                        column: x => x.UsersId,
-                        principalTable: "AspNetUsers",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "IdentityRole",
-                columns: table => new
-                {
-                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
-                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_IdentityRole", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "Permissions",
-                columns: table => new
-                {
-                    Id = table.Column<long>(type: "bigint", nullable: false)
-                        .Annotation("SqlServer:Identity", "1, 1"),
-                    Name = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
-                    CategoryName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
-                    Desc = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
-                    Show = table.Column<bool>(type: "bit", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_Permissions", x => x.Id);
-                });
-
-            migrationBuilder.CreateTable(
-                name: "RolePermissions",
-                columns: table => new
-                {
-                    Id = table.Column<long>(type: "bigint", nullable: false)
-                        .Annotation("SqlServer:Identity", "1, 1"),
-                    RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
-                    PermissionId = table.Column<long>(type: "bigint", nullable: false),
-                    PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: false)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_RolePermissions", x => x.Id);
-                    table.ForeignKey(
-                        name: "FK_RolePermissions_AspNetRoles_RoleId",
-                        column: x => x.RoleId,
-                        principalTable: "AspNetRoles",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                    table.ForeignKey(
-                        name: "FK_RolePermissions_Permissions_PermissionId",
-                        column: x => x.PermissionId,
-                        principalTable: "Permissions",
-                        principalColumn: "Id",
-                        onDelete: ReferentialAction.Cascade);
-                });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "CreateUser", "DeleteUserId", "IsDeleted", "IsStopped", "ManagerId", "SecurityStamp", "UpdateUser", "UserType" },
-                values: new object[] { "b6b32734-b83c-4619-8de6-6e0e48cea904", null, null, false, false, null, "2ec2e41b-9f51-4779-9687-4cef7afd2c98", null, 1 });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "CreateUser", "DeleteUserId", "IsDeleted", "IsStopped", "ManagerId", "SecurityStamp", "UpdateUser", "UserType" },
-                values: new object[] { "f3684ce0-8dc7-4f91-b317-b6a7d8d55011", null, null, false, false, null, "50a3c8b2-93bf-41b3-bf7f-d2240d8b7386", null, 1 });
-
-            migrationBuilder.InsertData(
-                table: "IdentityRole",
-                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
-                });
-
-            migrationBuilder.CreateIndex(
-                name: "IX_AspNetUsers_ManagerId",
-                table: "AspNetUsers",
-                column: "ManagerId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_ApplicationRoleApplicationUser_UsersId",
-                table: "ApplicationRoleApplicationUser",
-                column: "UsersId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_RolePermissions_PermissionId",
-                table: "RolePermissions",
-                column: "PermissionId");
-
-            migrationBuilder.CreateIndex(
-                name: "IX_RolePermissions_RoleId",
-                table: "RolePermissions",
-                column: "RoleId");
-
-            migrationBuilder.AddForeignKey(
-                name: "FK_AspNetUsers_AspNetUsers_ManagerId",
-                table: "AspNetUsers",
-                column: "ManagerId",
-                principalTable: "AspNetUsers",
-                principalColumn: "Id");
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropForeignKey(
-                name: "FK_AspNetUsers_AspNetUsers_ManagerId",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropTable(
-                name: "ApplicationRoleApplicationUser");
-
-            migrationBuilder.DropTable(
-                name: "IdentityRole");
-
-            migrationBuilder.DropTable(
-                name: "RolePermissions");
-
-            migrationBuilder.DropTable(
-                name: "Permissions");
-
-            migrationBuilder.DropIndex(
-                name: "IX_AspNetUsers_ManagerId",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "CreateUser",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "DeleteUserId",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "IsDeleted",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "IsStopped",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "ManagerId",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "UpdateUser",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "UserType",
-                table: "AspNetUsers");
-
-            migrationBuilder.DropColumn(
-                name: "CreateDate",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "CreateUser",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "DeleteUserId",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "IsAdmin",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "IsDeleted",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "UpdateDate",
-                table: "AspNetRoles");
-
-            migrationBuilder.DropColumn(
-                name: "UpdateUser",
-                table: "AspNetRoles");
-
-            migrationBuilder.InsertData(
-                table: "AspNetRoles",
-                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
-                });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "d1e41737-1312-47fe-b7e9-fa9917dd94ad", "7714198f-15f6-4524-a221-b0826892516b" });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "fe634cad-b63a-4cc1-8938-4499edd22d35", "bba3264c-1777-4ca7-837a-2f8ed1b16d01" });
-        }
-    }
-}

+ 0 - 546
MTWorkHR.Identity/Migrations/20240124091904_altrIdentity2.Designer.cs

@@ -1,546 +0,0 @@
-// <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("20240124091904_altrIdentity2")]
-    partial class altrIdentity2
-    {
-        /// <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.Identity.Models.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);
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.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>("FirstName")
-                        .IsRequired()
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("IsDeleted")
-                        .HasColumnType("bit");
-
-                    b.Property<bool>("IsStopped")
-                        .HasColumnType("bit");
-
-                    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>("PasswordHash")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("PhoneNumber")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("PhoneNumberConfirmed")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("SecurityStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("TwoFactorEnabled")
-                        .HasColumnType("bit");
-
-                    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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "9db21270-bc4c-40e0-8db7-21c2a932d26d",
-                            Email = "a@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Zinab",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Elgendy",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "A@B.COM",
-                            NormalizedUserName = "ADMIN",
-                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "3e4eb597-09f6-44fb-8bb1-7027cd4a0eda",
-                            TwoFactorEnabled = false,
-                            UserName = "Admin",
-                            UserType = 1
-                        },
-                        new
-                        {
-                            Id = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "32f0f04a-dbd7-4a86-9b4b-63dcf2ad75f7",
-                            Email = "ali@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Ali",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Farok",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "ALI@B.COM",
-                            NormalizedUserName = "ALI",
-                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "7424f406-f7db-4698-bdb3-c7e28214619c",
-                            TwoFactorEnabled = false,
-                            UserName = "ali",
-                            UserType = 1
-                        });
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.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.Models.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("Microsoft.AspNetCore.Identity.IdentityRole", b =>
-                {
-                    b.Property<string>("Id")
-                        .HasColumnType("nvarchar(450)");
-
-                    b.Property<string>("ConcurrencyStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("Name")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("NormalizedName")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.HasKey("Id");
-
-                    b.ToTable("IdentityRole");
-
-                    b.HasData(
-                        new
-                        {
-                            Id = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B",
-                            Name = "Admin",
-                            NormalizedName = "ADMIN"
-                        },
-                        new
-                        {
-                            Id = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A",
-                            Name = "Employee",
-                            NormalizedName = "EMPLOYEE"
-                        });
-                });
-
-            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 = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                            RoleId = "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B"
-                        },
-                        new
-                        {
-                            UserId = "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            RoleId = "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A"
-                        });
-                });
-
-            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.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("UserRolesId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UsersId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", "Manager")
-                        .WithMany()
-                        .HasForeignKey("ManagerId");
-
-                    b.Navigation("Manager");
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.Permission", "Permission")
-                        .WithMany()
-                        .HasForeignKey("PermissionId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", "Role")
-                        .WithMany("RolePermissions")
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.Navigation("Permission");
-
-                    b.Navigation("Role");
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
-                {
-                    b.Navigation("RolePermissions");
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 0 - 46
MTWorkHR.Identity/Migrations/20240124091904_altrIdentity2.cs

@@ -1,46 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace MTWorkHR.Identity.Migrations
-{
-    /// <inheritdoc />
-    public partial class altrIdentity2 : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "9db21270-bc4c-40e0-8db7-21c2a932d26d", "3e4eb597-09f6-44fb-8bb1-7027cd4a0eda" });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "32f0f04a-dbd7-4a86-9b4b-63dcf2ad75f7", "7424f406-f7db-4698-bdb3-c7e28214619c" });
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "b6b32734-b83c-4619-8de6-6e0e48cea904", "2ec2e41b-9f51-4779-9687-4cef7afd2c98" });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "f3684ce0-8dc7-4f91-b317-b6a7d8d55011", "50a3c8b2-93bf-41b3-bf7f-d2240d8b7386" });
-        }
-    }
-}

+ 0 - 533
MTWorkHR.Identity/Migrations/20240124093416_altrIdentity3.Designer.cs

@@ -1,533 +0,0 @@
-// <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("20240124093416_altrIdentity3")]
-    partial class altrIdentity3
-    {
-        /// <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.Identity.Models.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.Models.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>("FirstName")
-                        .IsRequired()
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("IsDeleted")
-                        .HasColumnType("bit");
-
-                    b.Property<bool>("IsStopped")
-                        .HasColumnType("bit");
-
-                    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>("PasswordHash")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<string>("PhoneNumber")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("PhoneNumberConfirmed")
-                        .HasColumnType("bit");
-
-                    b.Property<string>("SecurityStamp")
-                        .HasColumnType("nvarchar(max)");
-
-                    b.Property<bool>("TwoFactorEnabled")
-                        .HasColumnType("bit");
-
-                    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 = "14e7547f-8984-433b-af19-5321a2471f8e",
-                            Email = "a@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Zinab",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Elgendy",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "A@B.COM",
-                            NormalizedUserName = "ADMIN",
-                            PasswordHash = "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "9355e051-c970-4587-a424-ed11b0b4c606",
-                            TwoFactorEnabled = false,
-                            UserName = "Admin",
-                            UserType = 1
-                        },
-                        new
-                        {
-                            Id = "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                            AccessFailedCount = 0,
-                            ConcurrencyStamp = "fbae36cf-e1c8-4567-852c-636c111ac689",
-                            Email = "ali@b.com",
-                            EmailConfirmed = true,
-                            FirstName = "Ali",
-                            IsDeleted = false,
-                            IsStopped = false,
-                            LastName = "Farok",
-                            LockoutEnabled = false,
-                            NormalizedEmail = "ALI@B.COM",
-                            NormalizedUserName = "ALI",
-                            PasswordHash = "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==",
-                            PhoneNumber = "1234567890",
-                            PhoneNumberConfirmed = true,
-                            SecurityStamp = "3df3d0ca-c1ec-44cf-aee0-3f8405634a8f",
-                            TwoFactorEnabled = false,
-                            UserName = "ali",
-                            UserType = 1
-                        });
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.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.Models.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("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.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("UserRolesId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UsersId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationUser", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", "Manager")
-                        .WithMany()
-                        .HasForeignKey("ManagerId");
-
-                    b.Navigation("Manager");
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.RolePermission", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.Permission", "Permission")
-                        .WithMany()
-                        .HasForeignKey("PermissionId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", "Role")
-                        .WithMany("RolePermissions")
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.Navigation("Permission");
-
-                    b.Navigation("Role");
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationRole", null)
-                        .WithMany()
-                        .HasForeignKey("RoleId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
-                {
-                    b.HasOne("MTWorkHR.Identity.Models.ApplicationUser", null)
-                        .WithMany()
-                        .HasForeignKey("UserId")
-                        .OnDelete(DeleteBehavior.Cascade)
-                        .IsRequired();
-                });
-
-            modelBuilder.Entity("MTWorkHR.Identity.Models.ApplicationRole", b =>
-                {
-                    b.Navigation("RolePermissions");
-                });
-#pragma warning restore 612, 618
-        }
-    }
-}

+ 0 - 142
MTWorkHR.Identity/Migrations/20240124093416_altrIdentity3.cs

@@ -1,142 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
-
-namespace MTWorkHR.Identity.Migrations
-{
-    /// <inheritdoc />
-    public partial class altrIdentity3 : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DropTable(
-                name: "IdentityRole");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUserRoles",
-                keyColumns: new[] { "RoleId", "UserId" },
-                keyValues: new object[] { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA" });
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUserRoles",
-                keyColumns: new[] { "RoleId", "UserId" },
-                keyValues: new object[] { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" });
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB");
-
-            migrationBuilder.InsertData(
-                table: "AspNetRoles",
-                columns: new[] { "Id", "ConcurrencyStamp", "CreateDate", "CreateUser", "DeleteUserId", "IsAdmin", "IsDeleted", "Name", "NormalizedName", "UpdateDate", "UpdateUser" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, true, false, "Admin", "ADMIN", null, null },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, false, false, "Employee", "EMPLOYEE", null, null }
-                });
-
-            migrationBuilder.InsertData(
-                table: "AspNetUsers",
-                columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "CreateUser", "DeleteUserId", "Email", "EmailConfirmed", "FirstName", "IsDeleted", "IsStopped", "LastName", "LockoutEnabled", "LockoutEnd", "ManagerId", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UpdateUser", "UserName", "UserType" },
-                values: new object[,]
-                {
-                    { "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "14e7547f-8984-433b-af19-5321a2471f8e", null, null, "a@b.com", true, "Zinab", false, false, "Elgendy", false, null, null, "A@B.COM", "ADMIN", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, "9355e051-c970-4587-a424-ed11b0b4c606", false, null, "Admin", 1 },
-                    { "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "fbae36cf-e1c8-4567-852c-636c111ac689", null, null, "ali@b.com", true, "Ali", false, false, "Farok", false, null, null, "ALI@B.COM", "ALI", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, "3df3d0ca-c1ec-44cf-aee0-3f8405634a8f", false, null, "ali", 1 }
-                });
-
-            migrationBuilder.InsertData(
-                table: "AspNetUserRoles",
-                columns: new[] { "RoleId", "UserId" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
-                });
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.DeleteData(
-                table: "AspNetUserRoles",
-                keyColumns: new[] { "RoleId", "UserId" },
-                keyValues: new object[] { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA" });
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUserRoles",
-                keyColumns: new[] { "RoleId", "UserId" },
-                keyValues: new object[] { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" });
-
-            migrationBuilder.DeleteData(
-                table: "AspNetRoles",
-                keyColumn: "Id",
-                keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetRoles",
-                keyColumn: "Id",
-                keyValue: "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA");
-
-            migrationBuilder.DeleteData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB");
-
-            migrationBuilder.CreateTable(
-                name: "IdentityRole",
-                columns: table => new
-                {
-                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
-                    ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
-                    NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: true)
-                },
-                constraints: table =>
-                {
-                    table.PrimaryKey("PK_IdentityRole", x => x.Id);
-                });
-
-            migrationBuilder.InsertData(
-                table: "AspNetUsers",
-                columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "CreateUser", "DeleteUserId", "Email", "EmailConfirmed", "FirstName", "IsDeleted", "IsStopped", "LastName", "LockoutEnabled", "LockoutEnd", "ManagerId", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UpdateUser", "UserName", "UserType" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "9db21270-bc4c-40e0-8db7-21c2a932d26d", null, null, "a@b.com", true, "Zinab", false, false, "Elgendy", false, null, null, "A@B.COM", "ADMIN", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, "3e4eb597-09f6-44fb-8bb1-7027cd4a0eda", false, null, "Admin", 1 },
-                    { "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "32f0f04a-dbd7-4a86-9b4b-63dcf2ad75f7", null, null, "ali@b.com", true, "Ali", false, false, "Farok", false, null, null, "ALI@B.COM", "ALI", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, "7424f406-f7db-4698-bdb3-c7e28214619c", false, null, "ali", 1 }
-                });
-
-            migrationBuilder.InsertData(
-                table: "IdentityRole",
-                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
-                });
-
-            migrationBuilder.InsertData(
-                table: "AspNetUserRoles",
-                columns: new[] { "RoleId", "UserId" },
-                values: new object[,]
-                {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
-                });
-        }
-    }
-}

+ 0 - 46
MTWorkHR.Identity/Migrations/20240124094323_altrIdentity4.cs

@@ -1,46 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace MTWorkHR.Identity.Migrations
-{
-    /// <inheritdoc />
-    public partial class altrIdentity4 : Migration
-    {
-        /// <inheritdoc />
-        protected override void Up(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "7cc87689-9eab-4280-b8e3-1834080783a5", "49bb16c3-4704-4c60-908d-dc8506950acc" });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "4af7b4cf-802a-455b-b598-997e167745b3", "62549056-1b9d-46d4-84f8-adea3e4d8b68" });
-        }
-
-        /// <inheritdoc />
-        protected override void Down(MigrationBuilder migrationBuilder)
-        {
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "14e7547f-8984-433b-af19-5321a2471f8e", "9355e051-c970-4587-a424-ed11b0b4c606" });
-
-            migrationBuilder.UpdateData(
-                table: "AspNetUsers",
-                keyColumn: "Id",
-                keyValue: "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
-                columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
-                values: new object[] { "fbae36cf-e1c8-4567-852c-636c111ac689", "3df3d0ca-c1ec-44cf-aee0-3f8405634a8f" });
-        }
-    }
-}

+ 2 - 2
MTWorkHR.Identity/Migrations/20240124094323_altrIdentity4.Designer.cs

@@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 namespace MTWorkHR.Identity.Migrations
 {
     [DbContext(typeof(HRIdentityDBContext))]
-    [Migration("20240124094323_altrIdentity4")]
-    partial class altrIdentity4
+    [Migration("20240128145047_InitialCreate")]
+    partial class InitialCreate
     {
         /// <inheritdoc />
         protected override void BuildTargetModel(ModelBuilder modelBuilder)

+ 125 - 10
MTWorkHR.Identity/Migrations/20240115092554_identity.cs

@@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
 namespace MTWorkHR.Identity.Migrations
 {
     /// <inheritdoc />
-    public partial class identity : Migration
+    public partial class InitialCreate : Migration
     {
         /// <inheritdoc />
         protected override void Up(MigrationBuilder migrationBuilder)
@@ -18,6 +18,13 @@ namespace MTWorkHR.Identity.Migrations
                 columns: table => new
                 {
                     Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
+                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
+                    DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    IsAdmin = table.Column<bool>(type: "bit", nullable: true),
                     Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                     NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                     ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
@@ -34,6 +41,13 @@ namespace MTWorkHR.Identity.Migrations
                     Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                     FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                     LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserType = table.Column<int>(type: "int", nullable: false),
+                    ManagerId = table.Column<string>(type: "nvarchar(450)", nullable: true),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(max)", nullable: true),
+                    IsStopped = table.Column<bool>(type: "bit", nullable: false),
+                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
+                    DeleteUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                     UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                     NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                     Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
@@ -52,6 +66,27 @@ namespace MTWorkHR.Identity.Migrations
                 constraints: table =>
                 {
                     table.PrimaryKey("PK_AspNetUsers", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_AspNetUsers_AspNetUsers_ManagerId",
+                        column: x => x.ManagerId,
+                        principalTable: "AspNetUsers",
+                        principalColumn: "Id");
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Permissions",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Name = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
+                    CategoryName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
+                    Desc = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
+                    Show = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Permissions", x => x.Id);
                 });
 
             migrationBuilder.CreateTable(
@@ -76,6 +111,30 @@ namespace MTWorkHR.Identity.Migrations
                 });
 
             migrationBuilder.CreateTable(
+                name: "ApplicationRoleApplicationUser",
+                columns: table => new
+                {
+                    UserRolesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
+                    UsersId = table.Column<string>(type: "nvarchar(450)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_ApplicationRoleApplicationUser", x => new { x.UserRolesId, x.UsersId });
+                    table.ForeignKey(
+                        name: "FK_ApplicationRoleApplicationUser_AspNetRoles_UserRolesId",
+                        column: x => x.UserRolesId,
+                        principalTable: "AspNetRoles",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_ApplicationRoleApplicationUser_AspNetUsers_UsersId",
+                        column: x => x.UsersId,
+                        principalTable: "AspNetUsers",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
+            migrationBuilder.CreateTable(
                 name: "AspNetUserClaims",
                 columns: table => new
                 {
@@ -160,22 +219,49 @@ namespace MTWorkHR.Identity.Migrations
                         onDelete: ReferentialAction.Cascade);
                 });
 
+            migrationBuilder.CreateTable(
+                name: "RolePermissions",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
+                    PermissionId = table.Column<long>(type: "bigint", nullable: false),
+                    PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_RolePermissions", x => x.Id);
+                    table.ForeignKey(
+                        name: "FK_RolePermissions_AspNetRoles_RoleId",
+                        column: x => x.RoleId,
+                        principalTable: "AspNetRoles",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                    table.ForeignKey(
+                        name: "FK_RolePermissions_Permissions_PermissionId",
+                        column: x => x.PermissionId,
+                        principalTable: "Permissions",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+
             migrationBuilder.InsertData(
                 table: "AspNetRoles",
-                columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
+                columns: new[] { "Id", "ConcurrencyStamp", "CreateDate", "CreateUser", "DeleteUserId", "IsAdmin", "IsDeleted", "Name", "NormalizedName", "UpdateDate", "UpdateUser" },
                 values: new object[,]
                 {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
+                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, true, false, "Admin", "ADMIN", null, null },
+                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, false, false, "Employee", "EMPLOYEE", null, null }
                 });
 
             migrationBuilder.InsertData(
                 table: "AspNetUsers",
-                columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FirstName", "LastName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName" },
+                columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "CreateUser", "DeleteUserId", "Email", "EmailConfirmed", "FirstName", "IsDeleted", "IsStopped", "LastName", "LockoutEnabled", "LockoutEnd", "ManagerId", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UpdateUser", "UserName", "UserType" },
                 values: new object[,]
                 {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "d1e41737-1312-47fe-b7e9-fa9917dd94ad", "a@b.com", true, "Zinab", "Elgendy", false, null, "A@B.COM", "ADMIN", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, "7714198f-15f6-4524-a221-b0826892516b", false, "Admin" },
-                    { "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "fe634cad-b63a-4cc1-8938-4499edd22d35", "ali@b.com", true, "Ali", "Farok", false, null, "ALI@B.COM", "ALI", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, "bba3264c-1777-4ca7-837a-2f8ed1b16d01", false, "ali" }
+                    { "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA", 0, "7cc87689-9eab-4280-b8e3-1834080783a5", null, null, "a@b.com", true, "Zinab", false, false, "Elgendy", false, null, null, "A@B.COM", "ADMIN", "AQAAAAIAAYagAAAAEPg+ASbciPFxtyxQq8Wx5ilBUQ0RbAoITXXkOQm1PzC5BzySX0sn/wUmOjBKPDGV9w==", "1234567890", true, "49bb16c3-4704-4c60-908d-dc8506950acc", false, null, "Admin", 1 },
+                    { "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB", 0, "4af7b4cf-802a-455b-b598-997e167745b3", null, null, "ali@b.com", true, "Ali", false, false, "Farok", false, null, null, "ALI@B.COM", "ALI", "AQAAAAIAAYagAAAAEI3QJkcZjCH4Y8Db4rEgL8Mmll5oCvYcWiXZjQSN9bGW4SMcjHe3ZPMnkN/l9DmJeQ==", "1234567890", true, "62549056-1b9d-46d4-84f8-adea3e4d8b68", false, null, "ali", 1 }
                 });
 
             migrationBuilder.InsertData(
@@ -183,11 +269,16 @@ namespace MTWorkHR.Identity.Migrations
                 columns: new[] { "RoleId", "UserId" },
                 values: new object[,]
                 {
-                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
-                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
+                    { "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211A", "ADMB3B92-2311-48F8-9DEC-F9FAEF1F21UA" },
+                    { "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211E", "AL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB" }
                 });
 
             migrationBuilder.CreateIndex(
+                name: "IX_ApplicationRoleApplicationUser_UsersId",
+                table: "ApplicationRoleApplicationUser",
+                column: "UsersId");
+
+            migrationBuilder.CreateIndex(
                 name: "IX_AspNetRoleClaims_RoleId",
                 table: "AspNetRoleClaims",
                 column: "RoleId");
@@ -220,17 +311,35 @@ namespace MTWorkHR.Identity.Migrations
                 column: "NormalizedEmail");
 
             migrationBuilder.CreateIndex(
+                name: "IX_AspNetUsers_ManagerId",
+                table: "AspNetUsers",
+                column: "ManagerId");
+
+            migrationBuilder.CreateIndex(
                 name: "UserNameIndex",
                 table: "AspNetUsers",
                 column: "NormalizedUserName",
                 unique: true,
                 filter: "[NormalizedUserName] IS NOT NULL");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_RolePermissions_PermissionId",
+                table: "RolePermissions",
+                column: "PermissionId");
+
+            migrationBuilder.CreateIndex(
+                name: "IX_RolePermissions_RoleId",
+                table: "RolePermissions",
+                column: "RoleId");
         }
 
         /// <inheritdoc />
         protected override void Down(MigrationBuilder migrationBuilder)
         {
             migrationBuilder.DropTable(
+                name: "ApplicationRoleApplicationUser");
+
+            migrationBuilder.DropTable(
                 name: "AspNetRoleClaims");
 
             migrationBuilder.DropTable(
@@ -246,10 +355,16 @@ namespace MTWorkHR.Identity.Migrations
                 name: "AspNetUserTokens");
 
             migrationBuilder.DropTable(
-                name: "AspNetRoles");
+                name: "RolePermissions");
 
             migrationBuilder.DropTable(
                 name: "AspNetUsers");
+
+            migrationBuilder.DropTable(
+                name: "AspNetRoles");
+
+            migrationBuilder.DropTable(
+                name: "Permissions");
         }
     }
 }

+ 8 - 6
MTWorkHR.Infrastructure/EmailService/EmailSender.cs

@@ -61,12 +61,14 @@ namespace MTWorkHR.Infrastructure.EmailService
 
             builder.HtmlBody = email.Body;
             emailObj.Body = builder.ToMessageBody();
-
-            using var smtp = new SmtpClient();
-            smtp.Connect(_emailSettings.Host, _emailSettings.Port, MailKit.Security.SecureSocketOptions.StartTls);
-            smtp.Authenticate(_emailSettings.FromAddress, _emailSettings.Password);
-            await smtp.SendAsync(emailObj);
-            smtp.Disconnect(true);
+            try
+            {
+                using var smtp = new SmtpClient();
+                smtp.Connect(_emailSettings.Host, _emailSettings.Port, MailKit.Security.SecureSocketOptions.StartTls);
+                smtp.Authenticate(_emailSettings.FromAddress, _emailSettings.Password);
+                await smtp.SendAsync(emailObj);
+                smtp.Disconnect(true);
+            }catch (Exception ex) { var ms = ex.Message; }
             return true;
         }
     }