zinab_elgendy 1 рік тому
батько
коміт
01cc77f212
35 змінених файлів з 2228 додано та 111 видалено
  1. 0 33
      MTWorkHR.API/Controllers/WeatherForecastController.cs
  2. 15 2
      MTWorkHR.API/Program.cs
  3. 0 13
      MTWorkHR.API/WeatherForecast.cs
  4. 31 0
      MTWorkHR.Application/Filters/InputValidationActionFilter.cs
  5. 2 1
      MTWorkHR.Application/Identity/IUserService.cs
  6. 2 0
      MTWorkHR.Application/MTWorkHR.Application.csproj
  7. 182 0
      MTWorkHR.Application/Middlewares/LoggingMiddleware.cs
  8. 3 1
      MTWorkHR.Application/Models/Identity/AttachmentDto.cs
  9. 23 26
      MTWorkHR.Application/Services/Auth/UserService.cs
  10. 15 1
      MTWorkHR.Application/Services/Base/FileService.cs
  11. 38 0
      MTWorkHR.Application/Services/Base/LogService.cs
  12. 38 0
      MTWorkHR.Application/Services/DbMigrationService.cs
  13. 1 1
      MTWorkHR.Application/Services/EmployeeService.cs
  14. 1 1
      MTWorkHR.Application/Services/Interfaces/IFileService.cs
  15. 13 0
      MTWorkHR.Application/Services/Interfaces/ILogService.cs
  16. 5 3
      MTWorkHR.Application/Services/Email/IEmailSender.cs
  17. 1 1
      MTWorkHR.Application/Models/Email/EmailMessage.cs
  18. 1 1
      MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs
  19. 1 1
      MTWorkHR.Core/IUnitOfWork/IUnitOfWorkLog.cs
  20. 3 3
      MTWorkHR.Core/Logging/AuthenticateLog.cs
  21. 1 1
      MTWorkHR.Application/Logging/IAppLogger.cs
  22. 36 0
      MTWorkHR.Identity/Configurations/AttachmentTypeConfiguration.cs
  23. 751 0
      MTWorkHR.Identity/Migrations/20240214085318_addAttachmentType.Designer.cs
  24. 39 0
      MTWorkHR.Identity/Migrations/20240214085318_addAttachmentType.cs
  25. 16 0
      MTWorkHR.Identity/Migrations/HRIdentityDBContextModelSnapshot.cs
  26. 6 1
      MTWorkHR.Infrastructure/Data/HRDataContext.cs
  27. 4 4
      MTWorkHR.Infrastructure/EmailService/EmailSender.cs
  28. 4 6
      MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs
  29. 1 1
      MTWorkHR.Infrastructure/Logging/LoggerAdapter.cs
  30. 0 1
      MTWorkHR.Infrastructure/MTWorkHR.Infrastructure.csproj
  31. 404 0
      MTWorkHR.Infrastructure/Migrations/20240218144219_addLogs.Designer.cs
  32. 183 0
      MTWorkHR.Infrastructure/Migrations/20240218144219_addLogs.cs
  33. 401 0
      MTWorkHR.Infrastructure/Migrations/HRDataContextModelSnapshot.cs
  34. 3 3
      MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs
  35. 4 6
      MTWorkHR.Infrastructure/UnitOfWork/UnitOfWorkLog.cs

+ 0 - 33
MTWorkHR.API/Controllers/WeatherForecastController.cs

@@ -1,33 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-
-namespace MTWorkHR.API.Controllers
-{
-    [ApiController]
-    [Route("[controller]")]
-    public class WeatherForecastController : ControllerBase
-    {
-        private static readonly string[] Summaries = new[]
-        {
-            "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
-        };
-
-        private readonly ILogger<WeatherForecastController> _logger;
-
-        public WeatherForecastController(ILogger<WeatherForecastController> logger)
-        {
-            _logger = logger;
-        }
-
-        [HttpGet(Name = "GetWeatherForecast")]
-        public IEnumerable<WeatherForecast> Get()
-        {
-            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
-            {
-                Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
-                TemperatureC = Random.Shared.Next(-20, 55),
-                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
-            })
-            .ToArray();
-        }
-    }
-}

+ 15 - 2
MTWorkHR.API/Program.cs

@@ -6,6 +6,10 @@ using MTWorkHR.Infrastructure.Data;
 using Microsoft.EntityFrameworkCore;
 using MTWorkHR.Core;
 using MTWorkHR.Core.Global;
+using MTWorkHR.Application.Middlewares;
+using MTWorkHR.Application.Services.Interfaces;
+using MTWorkHR.Application.Filters;
+using MTWorkHR.Application.StartupService;
 
 var builder = WebApplication.CreateBuilder(args);
 
@@ -20,8 +24,16 @@ builder.Services.AddApplicationServices(config);
 builder.Services.AddInfrastructureServices(config);
 //builder.Services.AddPersistenceServices(builder.Configuration);
 builder.Services.AddIdentityServices(config);
+builder.Services.AddHostedService<DbMigrationService>();
 
-builder.Services.AddControllers();
+//builder.Services.AddControllers();
+builder.Services.AddControllers(options =>
+{
+    //add filter by instance
+    options.Filters.Add(new InputValidationActionFilter());
+    //add filter By the type 
+    options.Filters.Add(typeof(InputValidationActionFilter));
+});
 // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 builder.Services.AddEndpointsApiExplorer();
 builder.Services.AddSwaggerGen();
@@ -35,10 +47,11 @@ app.UseSwagger();
 app.UseSwaggerUI();
 // }
 
+
 app.UseHttpsRedirection();
 app.UseAuthentication();
 app.UseAuthorization();
-
+app.UseMiddleware<LoggingMiddleware>();
 app.MapControllers();
 
 app.Run();

+ 0 - 13
MTWorkHR.API/WeatherForecast.cs

@@ -1,13 +0,0 @@
-namespace MTWorkHR.API
-{
-    public class WeatherForecast
-    {
-        public DateOnly Date { get; set; }
-
-        public int TemperatureC { get; set; }
-
-        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-
-        public string? Summary { get; set; }
-    }
-}

+ 31 - 0
MTWorkHR.Application/Filters/InputValidationActionFilter.cs

@@ -0,0 +1,31 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using MTWorkHR.Core.Global;
+using NeomtechERP.Auth.Core.Global;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Application.Filters
+{
+    public class InputValidationActionFilter : Attribute, IAsyncActionFilter
+    {
+        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+        {
+            if (!context.ModelState.IsValid)
+            {
+                //Customize your error message
+                string messages = string.Join("; ", context.ModelState.Values
+                         .SelectMany(x => x.Errors)
+                         .Select(x => !string.IsNullOrWhiteSpace(x.ErrorMessage) ? x.ErrorMessage : x.Exception?.Message.ToString()));
+                context.RouteData.Values.Add("message", messages);
+
+                throw new AppException(messages);
+            }
+
+            await next();
+        }
+    }
+}

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

@@ -1,4 +1,5 @@
-using MTWorkHR.Application.Models;
+using Microsoft.AspNetCore.Http;
+using MTWorkHR.Application.Models;
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 2 - 0
MTWorkHR.Application/MTWorkHR.Application.csproj

@@ -19,10 +19,12 @@
   <ItemGroup>
     <ProjectReference Include="..\MTWorkHR.Core\MTWorkHR.Core.csproj" />
     <ProjectReference Include="..\MTWorkHR.Identity\MTWorkHR.Identity.csproj" />
+    <ProjectReference Include="..\MTWorkHR.Infrastructure\MTWorkHR.Infrastructure.csproj" />
   </ItemGroup>
 
   <ItemGroup>
     <Folder Include="Contracts\" />
+    <Folder Include="Logging\" />
   </ItemGroup>
 
 </Project>

+ 182 - 0
MTWorkHR.Application/Middlewares/LoggingMiddleware.cs

@@ -0,0 +1,182 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.Data.SqlClient;
+using Microsoft.Extensions.Primitives;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using MTWorkHR.Core.UnitOfWork;
+using MTWorkHR.Application.Services;
+using MTWorkHR.Core.Global;
+
+namespace MTWorkHR.Application.Middlewares
+{
+    public class LoggingMiddleware
+    {
+        private readonly RequestDelegate _next;
+
+        public LoggingMiddleware(RequestDelegate next)
+        {
+            _next = next;
+        }
+
+        public async Task Invoke(HttpContext context, IUnitOfWorkLog unitOfWork)
+        {
+            try
+            {
+                await _next(context);
+            }
+            catch (Exception error)
+            {
+                //Get target controller info
+                var controllerActionDescriptor = context?
+                    .GetEndpoint()?
+                    .Metadata
+                    .GetMetadata<ControllerActionDescriptor>();
+
+                //get controllerName & actionName
+                var controllerName = controllerActionDescriptor?.ControllerName;
+                var actionName = controllerActionDescriptor?.ActionName;
+
+                //get QueryString
+                var req = context?.Request;
+                var QueryString = req?.QueryString.Value?.ToString();
+
+                // get request body
+                string bodyStr;
+                req.EnableBuffering();
+                req.Body.Seek(0, SeekOrigin.Begin);
+                req.Body.Position = 0;
+                using (StreamReader reader
+                          = new StreamReader(req.Body, Encoding.UTF8, true, 1024, true))
+                {
+                    bodyStr = await reader.ReadToEndAsync();
+                }
+
+
+                //**Get Log service and entity info by refliction
+
+                //Get target log entity by the traget controller name
+                Type? entityType = Type.GetType("MTWorkHR.Core.Entities." + controllerName + "Log, MTWorkHR.Core");
+
+                var logServiceWithGenericType = typeof(LogService<>).MakeGenericType(entityType);
+
+                dynamic service = Activator.CreateInstance(logServiceWithGenericType, new object[] { unitOfWork });
+
+                var msg = error is AppException ? ((AppException)error).ErrorMessage : error.Message;
+                dynamic logEnitity = Activator.CreateInstance(entityType, new object[] {
+                    actionName, QueryString, bodyStr, DateTime.Now, "",GetLocalIPAddress(), GetServerIp(context), GetUserExternalIp(context), "", "", msg, error?.InnerException?.Message });
+
+
+                //finally call service.create to insert the log
+                await service.Create(logEnitity);
+                //****
+
+                switch (error)
+                {
+                    case AppException e:
+                        {
+                            context.Response.Clear();
+                            context.Response.ContentType = "text/plain";
+                            context.Response.StatusCode = StatusCodes.Status400BadRequest;
+                            await context.Response.WriteAsJsonAsync(
+                             new BadRequestResult
+                             {
+                                 ErrorMsg = "*_*" + ((AppException)error).ErrorMessage + "*_*"
+                             });
+                            return;
+                        }
+                    default:
+                        {
+                            context.Response.Clear();
+                            context.Response.ContentType = "text/plain";
+                            context.Response.StatusCode = StatusCodes.Status500InternalServerError;
+                            await context.Response.WriteAsync("*_*" + "Internal Server Error" + "*_*");
+                            return;
+
+                        }
+                }
+            }
+        }
+        public static string GetServerIp(HttpContext context)
+        {
+            try
+            {
+                IPAddress ipAddressString = context.Connection.LocalIpAddress;
+                string REMOTE_ADDR = context.GetServerVariable("REMOTE_ADDR");
+                string LOCAL_ADDR = context.GetServerVariable("LOCAL_ADDR");
+                string SERVER_ADDR = context.GetServerVariable("SERVER_ADDR"); 
+                string REMOTE_HOST = context.GetServerVariable("REMOTE_HOST"); 
+
+                string result = "LocalIpAddress: "+ipAddressString.ToString();
+                result += "  REMOTE_ADDR: " + REMOTE_ADDR + "  LOCAL_ADDR:" + LOCAL_ADDR
+                    + "  SERVER_ADDR:" + SERVER_ADDR + "  REMOTE_HOST:" + REMOTE_HOST;
+
+                return result;
+            }
+            catch (Exception e)
+            {
+                return "";
+            }
+        }
+        public static string GetLocalIPAddress()
+        {
+            try
+            {
+                var host = Dns.GetHostEntry(Dns.GetHostName());
+                foreach (var ip in host.AddressList)
+                {
+
+                    if (ip.AddressFamily == AddressFamily.InterNetwork)
+                    {
+                        return ip.ToString();
+                    }
+                }
+                return "";
+            }
+            catch (Exception e)
+            {
+                return "";
+            }
+        }
+
+        public static string GetUserExternalIp(HttpContext context)
+        {
+            try
+            {
+                IPAddress remoteIpAddress = context.Connection.RemoteIpAddress;
+                string result = "";
+                if (remoteIpAddress != null)
+                {
+                    // If we got an IPV6 address, then we need to ask the network for the IPV4 address 
+                    // This usually only happens when the browser is on the same machine as the server.
+                    if (remoteIpAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
+                    {
+                        remoteIpAddress = System.Net.Dns.GetHostEntry(remoteIpAddress).AddressList
+                            .First(x => x.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
+                    }
+                    result = remoteIpAddress.ToString();
+                }
+                return result;
+            }
+            catch (Exception e)
+            {
+                return "";
+            }
+        }
+    }
+
+    public class BadRequestResult
+    {
+        public string ErrorMsg { get; set; }
+        public int ErrorNo { get; set; }
+
+    }
+}

+ 3 - 1
MTWorkHR.Application/Models/Identity/AttachmentDto.cs

@@ -1,4 +1,5 @@
-using MTWorkHR.Core.Entities.Base;
+using Microsoft.AspNetCore.Http;
+using MTWorkHR.Core.Entities.Base;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations.Schema;
 
@@ -10,6 +11,7 @@ namespace MTWorkHR.Application.Models
 
         public string? AttachmentTypeName { get; set; }
 
+        public IFormFile? FileData { get; set; }
         public string FileName { get; set; }
 
         public string OriginalName { get; set; }

+ 23 - 26
MTWorkHR.Application/Services/Auth/UserService.cs

@@ -5,24 +5,13 @@ using Microsoft.Extensions.Configuration;
 using MTWorkHR.Application.Identity;
 using MTWorkHR.Application.Mapper;
 using MTWorkHR.Application.Models;
-using MTWorkHR.Application.Services;
-using MTWorkHR.Application.Models.Email;
 using MTWorkHR.Core.Global;
 using MTWorkHR.Core.IRepositories;
 using MTWorkHR.Core.UnitOfWork;
 using MTWorkHR.Identity.Entities;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using NeomtechERP.Auth.Core.Global;
-using Microsoft.AspNetCore.Identity.UI.Services;
-using IEmailSender = MTWorkHR.Application.Services.IEmailSender;
-using System.Security.Policy;
 using MTWorkHR.Application.Services.Interfaces;
-using Microsoft.AspNetCore.Mvc;
-using Azure.Core;
+using MTWorkHR.Core.Email;
+using MTWorkHR.Core.Entities;
 
 namespace MTWorkHR.Identity.Services
 {
@@ -33,12 +22,12 @@ namespace MTWorkHR.Identity.Services
         private readonly IUnitOfWork _unitOfWork;
         private readonly IUserRoleRepository<IdentityUserRole<string>> _userRole;
         private readonly AppSettingsConfiguration _configuration;
-        private readonly IEmailSender _emailSender;
+        private readonly IMailSender _emailSender;
         private readonly GlobalInfo _globalInfo;
         private readonly IFileService _fileService;
 
         public UserService(ApplicationUserManager userManager, IUnitOfWork unitOfWork
-             , RoleManager<ApplicationRole> roleManager, GlobalInfo globalInfo, AppSettingsConfiguration configuration, IEmailSender emailSender
+             , RoleManager<ApplicationRole> roleManager, GlobalInfo globalInfo, AppSettingsConfiguration configuration, IMailSender emailSender
             , IUserRoleRepository<IdentityUserRole<string>> userRole, IFileService fileService)
         {
             _userManager = userManager;
@@ -50,16 +39,18 @@ namespace MTWorkHR.Identity.Services
             _globalInfo = globalInfo;
             _fileService = fileService;
         }
-        public async Task<UserDto> GetById(string userId)
+       
+
+        public async Task<UserDto> GetById(string id)
         {
-            var employee = await _userManager.FindByIdAsync(userId);
-            return new UserDto
-            {
-                Email = employee.Email,
-                FirstName = employee.FirstName,
-                LastName = employee.LastName,
-                Id = employee.Id
-            };
+            var entity = await _userManager.Users
+                .Include(x => x.UserRoles)
+                .Include(x => x.UserAddress)
+                .Include(x => x.UserAttachments)
+                .FirstOrDefaultAsync(x => x.Id == id);
+            var response = MapperObject.Mapper.Map<UserDto>(entity);
+
+            return response;
         }
 
         public async Task<List<UserDto>> GetAll()
@@ -100,7 +91,9 @@ namespace MTWorkHR.Identity.Services
             if (userExists != null)
                 throw new AppException(ExceptionEnum.RecordAlreadyExist);
             //loop for given list of attachment, and move each file from Temp path to Actual path
-            if (!_fileService.CopyFileToActualFolder(input.UserAttachments.ToList()))
+          //  _fileService.UploadFiles(files);
+
+            if (!await _fileService.CopyFileToActualFolder(input.UserAttachments.ToList()))
                 throw new AppException(ExceptionEnum.CouldNotMoveFiles);
             var user = MapperObject.Mapper.Map<ApplicationUser>(input);
 
@@ -117,9 +110,13 @@ namespace MTWorkHR.Identity.Services
             foreach (var role in userRoles)
             {
                 role.UserId = user.Id;
+              //  var roleOb = input.UserRoles?.FirstOrDefault(r=> r.RoleId == role.RoleId) ;
+              //  var roleName = roleOb != null ? roleOb.RoleName : "Employee";
+              //  await _userManager.AddToRoleAsync(user, roleName);
                 if ((await _roleManager.FindByIdAsync(role.RoleId)) == null)
                     throw new AppException(ExceptionEnum.RecordNotExist);
             }
+            
             await _userRole.AddRangeAsync(userRoles);
 
             await _unitOfWork.CompleteAsync();
@@ -175,7 +172,7 @@ namespace MTWorkHR.Identity.Services
                 throw new AppException(ExceptionEnum.RecordNotExist);
 
             string token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
-            var route = "auth/forgetpassword";
+            var route = "auth/ConfirmEmail";
             var origin = _configuration.JwtSettings.Audience;
             var endpointUri = new Uri(string.Concat($"{origin}/", route));
             var userURL = QueryHelpers.AddQueryString(endpointUri.ToString(), "userId", user.Id);

+ 15 - 1
MTWorkHR.Application/Services/Base/FileService.cs

@@ -79,11 +79,25 @@ namespace MTWorkHR.Application.Services
             return contentType;
         }
 
-        public bool CopyFileToActualFolder(List<AttachmentDto> attachments)
+        public async Task<bool> CopyFileToActualFolder(List<AttachmentDto> attachments)
         {
          
             foreach (var attachment in attachments)
             {
+                var files = attachments.Select(a => a.FileData);
+                foreach (var formFile in files)
+                {
+                    if (formFile.Length > 0)
+                    {
+                        var filePath = Path.GetTempFileName();
+
+                        using (var stream = System.IO.File.Create(filePath))
+                        {
+                            await formFile.CopyToAsync(stream);
+                        }
+                    }
+                }
+
                 if (!Directory.Exists(GetActualAttachmentPath()))
                     Directory.CreateDirectory(GetActualAttachmentPath());
                 var tempFilePath = Path.Combine(GetTempAttachmentPath(), attachment.FileName);

+ 38 - 0
MTWorkHR.Application/Services/Base/LogService.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Reflection;
+using MTWorkHR.Application.Services.Interfaces;
+using MTWorkHR.Core.UnitOfWork;
+using MTWorkHR.Core.IRepositories.Base;
+
+namespace MTWorkHR.Application.Services
+{
+    public class LogService<TEntity>: ILogService<TEntity> where TEntity : class
+    {
+        private readonly IUnitOfWorkLog unitOfWork;
+
+        //private readonly IRepository<TEntity> repository;
+
+        public LogService(IUnitOfWorkLog _unitOfWork)
+        {
+            unitOfWork = _unitOfWork;
+            //this.repository = repository;
+            //repository = (IRepository<TEntity>)unitOfWork.GetRepositoryByName(typeof(TEntity).Name);
+        }
+
+
+
+        public virtual async Task Create(TEntity input)
+        {
+            IRepositoryLog<TEntity> repository = (IRepositoryLog<TEntity>)unitOfWork.GetRepositoryByName(input.GetType().Name);
+            //var repository = (IRepository<TEntity>)value;
+            await repository.AddAsync(input);
+
+            await unitOfWork.CompleteAsync();
+        }
+
+    }
+}

+ 38 - 0
MTWorkHR.Application/Services/DbMigrationService.cs

@@ -0,0 +1,38 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using MTWorkHR.Identity.DBContext;
+using MTWorkHR.Infrastructure.Data;
+
+namespace MTWorkHR.Application.StartupService;
+
+public class DbMigrationService : IHostedService
+{
+    private readonly IServiceProvider sp;
+
+    public DbMigrationService(IServiceProvider serviceProvider)
+    {
+        sp = serviceProvider;
+    }
+
+    public async Task StartAsync(CancellationToken cancellationToken)
+    {
+        using (var scope = sp.CreateScope())
+        {
+            var identityContext = scope.ServiceProvider.GetRequiredService<HRIdentityDBContext>();
+           
+
+            await identityContext.Database.EnsureCreatedAsync(cancellationToken);
+            await identityContext.Database.MigrateAsync(cancellationToken);
+
+            var HRDataContext = scope.ServiceProvider.GetRequiredService<HRDataContext>();
+            await HRDataContext.Database.EnsureCreatedAsync(cancellationToken);
+            await HRDataContext.Database.MigrateAsync(cancellationToken);
+        }
+    }
+
+    public Task StopAsync(CancellationToken cancellationToken)
+    {
+        return Task.CompletedTask;
+    }
+}

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

@@ -1,8 +1,8 @@
 using AutoMapper;
 using MTWorkHR.Application.Exceptions;
-using MTWorkHR.Application.Logging;
 using MTWorkHR.Application.Models;
 using MTWorkHR.Core.IRepositories;
+using MTWorkHR.Core.Logging;
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 1 - 1
MTWorkHR.Application/Services/Interfaces/IFileService.cs

@@ -12,7 +12,7 @@ namespace MTWorkHR.Application.Services.Interfaces
     {
         string UploadFile(IFormFile file);
         List<string> UploadFiles(List<IFormFile> files);
-        bool CopyFileToActualFolder(List<AttachmentDto> attachments);
+        Task<bool> CopyFileToActualFolder(List<AttachmentDto> attachments);
         bool CopyFileToActualFolder(string FileName);
         bool DeleteFileFromTempFolder(string FileName);
 

+ 13 - 0
MTWorkHR.Application/Services/Interfaces/ILogService.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTWorkHR.Application.Services.Interfaces
+{
+    public interface ILogService<TEntity>
+    {
+        Task Create(TEntity input);
+    }
+}

+ 5 - 3
MTWorkHR.Application/Services/Email/IEmailSender.cs

@@ -1,14 +1,16 @@
-using MTWorkHR.Application.Models.Email;
+using MTWorkHR.Core.Entities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Mail;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Application.Services
+namespace MTWorkHR.Core.Email
 {
-    public interface IEmailSender
+    public interface IMailSender
     {
         Task<bool> SendEmail(EmailMessage email);
+
     }
 }

+ 1 - 1
MTWorkHR.Application/Models/Email/EmailMessage.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Application.Models.Email
+namespace MTWorkHR.Core.Entities
 {
     public class EmailMessage
     {

+ 1 - 1
MTWorkHR.Core/IUnitOfWork/IUnitOfWork.cs

@@ -9,7 +9,7 @@ namespace MTWorkHR.Core.UnitOfWork
     public interface IUnitOfWork
     {
         IPermissionRepository Permission { get; }
-        //ICompanyRepository Company { get; }
+        ICompanyRepository Company { get; }
         Task<int> CompleteAsync();
 
         void BeginTran();

+ 1 - 1
MTWorkHR.Core/IUnitOfWork/IUnitOfWorkLog.cs

@@ -10,7 +10,7 @@ namespace MTWorkHR.Core.UnitOfWork
 
         IRepositoryLog<UserLog> UserLog { get; }
 
-        IRepositoryLog<AuthenticateLog> AuthenticateLog { get; }
+        IRepositoryLog<AuthLog> AuthLog { get; }
         IRepositoryLog<FileLog> FileLog { get; }
         IRepositoryLog<RoleLog> RoleLog { get; }
 

+ 3 - 3
MTWorkHR.Core/Logging/AuthenticateLog.cs

@@ -2,13 +2,13 @@
 
 namespace MTWorkHR.Core.Entities
 {
-    public class AuthenticateLog : Log
+    public class AuthLog : Log
     {
-        public AuthenticateLog():base()
+        public AuthLog():base()
         {
 
         }
-        public AuthenticateLog(string Method
+        public AuthLog(string Method
             , string QueryString
             , string Input
             , DateTime CreateDate

+ 1 - 1
MTWorkHR.Application/Logging/IAppLogger.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace MTWorkHR.Application.Logging
+namespace MTWorkHR.Core.Logging
 {
     public interface IAppLogger<T> 
     {

+ 36 - 0
MTWorkHR.Identity/Configurations/AttachmentTypeConfiguration.cs

@@ -0,0 +1,36 @@
+using Microsoft.AspNetCore.Identity;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using MTWorkHR.Identity.Entities;
+using MTWorkHR.Core.Entities.Base;
+
+namespace MTWorkHR.Identity.Configurations
+{
+    public class AttachmentTypeConfiguration : IEntityTypeConfiguration<AttachmentType>
+    {
+        
+        public void Configure(EntityTypeBuilder<AttachmentType> builder)
+        {
+            
+            builder.HasData(
+                new AttachmentType
+                {
+                    Id = 1,
+                    NameEn = "CV",
+                    NameAr = "السيرة الذاتية"
+                },
+                new AttachmentType
+                {
+                Id = 2,
+                    NameEn = "Identification",
+                    NameAr = "الهوية"
+                }
+               ) ;
+        }
+    }
+}

+ 751 - 0
MTWorkHR.Identity/Migrations/20240214085318_addAttachmentType.Designer.cs

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

+ 39 - 0
MTWorkHR.Identity/Migrations/20240214085318_addAttachmentType.cs

@@ -0,0 +1,39 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
+
+namespace MTWorkHR.Identity.Migrations
+{
+    /// <inheritdoc />
+    public partial class addAttachmentType : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.InsertData(
+                table: "AttachmentType",
+                columns: new[] { "Id", "IsRequired", "NameAr", "NameEn" },
+                values: new object[,]
+                {
+                    { 1L, false, "السيرة الذاتية", "CV" },
+                    { 2L, false, "الهوية", "Identification" }
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DeleteData(
+                table: "AttachmentType",
+                keyColumn: "Id",
+                keyValue: 1L);
+
+            migrationBuilder.DeleteData(
+                table: "AttachmentType",
+                keyColumn: "Id",
+                keyValue: 2L);
+        }
+    }
+}

+ 16 - 0
MTWorkHR.Identity/Migrations/HRIdentityDBContextModelSnapshot.cs

@@ -62,6 +62,22 @@ namespace MTWorkHR.Identity.Migrations
                     b.HasKey("Id");
 
                     b.ToTable("AttachmentType");
+
+                    b.HasData(
+                        new
+                        {
+                            Id = 1L,
+                            IsRequired = false,
+                            NameAr = "السيرة الذاتية",
+                            NameEn = "CV"
+                        },
+                        new
+                        {
+                            Id = 2L,
+                            IsRequired = false,
+                            NameAr = "الهوية",
+                            NameEn = "Identification"
+                        });
                 });
 
             modelBuilder.Entity("MTWorkHR.Identity.Entities.ApplicationRole", b =>

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

@@ -14,7 +14,12 @@ namespace MTWorkHR.Infrastructure.Data
     {
         public HRDataContext(DbContextOptions<HRDataContext> options) : base(options) { }
 
-       // public DbSet<Company> Companies { get; set; }
+        public DbSet<Company> Companies { get; set; }
+        public DbSet<UserLog> UserLogs { get; set; }
+        public DbSet<AuthLog> AuthLogs { get; set; }
+        public DbSet<FileLog> FileLogs { get; set; }
+        public DbSet<RoleLog> RoleLogs { get; set; }
+        public DbSet<SettingLog> SettingLogs { get; set; }
 
         protected override void OnModelCreating(ModelBuilder modelBuilder)
         {

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

@@ -1,8 +1,8 @@
 using MailKit.Net.Smtp;
 using Microsoft.Extensions.Options;
 using MimeKit;
-using MTWorkHR.Application.Models.Email;
-using MTWorkHR.Application.Services;
+using MTWorkHR.Core.Email;
+using MTWorkHR.Core.Entities;
 using MTWorkHR.Core.Global;
 using SendGrid;
 using SendGrid.Helpers.Mail;
@@ -14,10 +14,10 @@ using System.Threading.Tasks;
 
 namespace MTWorkHR.Infrastructure.EmailService
 {
-    public class EmailSender : IEmailSender
+    public class MailSender : IMailSender
     {
         public EmailSettings _emailSettings { get; }
-        public EmailSender(IOptions<EmailSettings> emailSettings) 
+        public MailSender(IOptions<EmailSettings> emailSettings) 
         {
             _emailSettings = emailSettings.Value;
         }

+ 4 - 6
MTWorkHR.Infrastructure/InfrastructureServiceRegistration.cs

@@ -1,10 +1,7 @@
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Configuration;
-using MTWorkHR.Application.Models.Email;
 using MTWorkHR.Infrastructure.EmailService;
-using MTWorkHR.Application.Logging;
 using MTWorkHR.Infrastructure.Logging;
-using MTWorkHR.Application.Services;
 using MTWorkHR.Core.Global;
 using Microsoft.AspNetCore.Identity;
 using Microsoft.EntityFrameworkCore;
@@ -15,6 +12,7 @@ using MTWorkHR.Identity.Entities;
 using MTWorkHR.Infrastructure.Data;
 using MTWorkHR.Infrastructure.Repositories;
 using MTWorkHR.Infrastructure.UnitOfWorks;
+using MTWorkHR.Core.Email;
 
 
 namespace MTWorkHR.Infrastructure
@@ -28,21 +26,21 @@ namespace MTWorkHR.Infrastructure
 
             services.AddScoped(typeof(IRepository<>), typeof(Repository<>));
             services.AddScoped(typeof(IRepositoryLog<>), typeof(RepositoryLog<>));
-            //services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository));
+            services.AddScoped(typeof(ICompanyRepository), typeof(CompanyRepository));
             services.AddScoped(typeof(IPermissionRepository), typeof(PermissionRepository));
             services.AddScoped(typeof(IRolePermissionRepository<RolePermission>), typeof(RolePermissionRepository));
             services.AddScoped(typeof(IUserRoleRepository<IdentityUserRole<string>>), typeof(UserRoleRepository));
 
             services.AddScoped<IUnitOfWork, UnitOfWork>();
             services.AddScoped<IUnitOfWorkLog, UnitOfWorkLog>();
+            services.AddTransient<IMailSender, MailSender>();
 
             services.AddScoped<ApplicationUserManager>();
             services.AddScoped<GlobalInfo>();
 
             services.AddScoped<IEmployeeRepository, EmployeeRepository>();
 
-            services.AddTransient<IEmailSender, EmailSender>();
-            services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
+            //services.AddScoped(typeof(IAppLogger<>), typeof(LoggerAdapter<>));
             return services;
         }
     }

+ 1 - 1
MTWorkHR.Infrastructure/Logging/LoggerAdapter.cs

@@ -1,5 +1,5 @@
 using Microsoft.Extensions.Logging;
-using MTWorkHR.Application.Logging;
+using MTWorkHR.Core.Logging;
 using System;
 using System.Collections.Generic;
 using System.Linq;

+ 0 - 1
MTWorkHR.Infrastructure/MTWorkHR.Infrastructure.csproj

@@ -24,7 +24,6 @@
   </ItemGroup>
 
   <ItemGroup>
-    <ProjectReference Include="..\MTWorkHR.Application\MTWorkHR.Application.csproj" />
     <ProjectReference Include="..\MTWorkHR.Core\MTWorkHR.Core.csproj" />
     <ProjectReference Include="..\MTWorkHR.Identity\MTWorkHR.Identity.csproj" />
   </ItemGroup>

+ 404 - 0
MTWorkHR.Infrastructure/Migrations/20240218144219_addLogs.Designer.cs

@@ -0,0 +1,404 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Infrastructure.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(HRDataContext))]
+    [Migration("20240218144219_addLogs")]
+    partial class addLogs
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.AuthLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AuthLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Company", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CRNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CompanyName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("TaxNumber")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<long>("UserId")
+                        .HasColumnType("bigint");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Companies");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.FileLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("FileLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.RoleLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoleLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.SettingLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("SettingLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.UserLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("UserLogs");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 183 - 0
MTWorkHR.Infrastructure/Migrations/20240218144219_addLogs.cs

@@ -0,0 +1,183 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    /// <inheritdoc />
+    public partial class addLogs : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "AuthLogs",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    QueryString = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Input = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Channel = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    InnerException = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    userAgent = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_AuthLogs", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Companies",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
+                    UserId = table.Column<long>(type: "bigint", nullable: false),
+                    CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CRNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    TaxNumber = table.Column<int>(type: "int", nullable: false),
+                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Companies", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "FileLogs",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    QueryString = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Input = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Channel = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    InnerException = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    userAgent = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_FileLogs", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "RoleLogs",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    QueryString = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Input = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Channel = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    InnerException = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    userAgent = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_RoleLogs", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "SettingLogs",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    QueryString = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Input = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Channel = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    InnerException = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    userAgent = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_SettingLogs", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "UserLogs",
+                columns: table => new
+                {
+                    Id = table.Column<long>(type: "bigint", nullable: false)
+                        .Annotation("SqlServer:Identity", "1, 1"),
+                    Method = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    QueryString = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Input = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
+                    CreateUser = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServerIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    Channel = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    UserIP = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ServiceResponseTimeInSeconds = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    ErrorDescription = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    InnerException = table.Column<string>(type: "nvarchar(max)", nullable: false),
+                    userAgent = table.Column<string>(type: "nvarchar(max)", nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_UserLogs", x => x.Id);
+                });
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "AuthLogs");
+
+            migrationBuilder.DropTable(
+                name: "Companies");
+
+            migrationBuilder.DropTable(
+                name: "FileLogs");
+
+            migrationBuilder.DropTable(
+                name: "RoleLogs");
+
+            migrationBuilder.DropTable(
+                name: "SettingLogs");
+
+            migrationBuilder.DropTable(
+                name: "UserLogs");
+        }
+    }
+}

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

@@ -0,0 +1,401 @@
+// <auto-generated />
+using System;
+using MTWorkHR.Infrastructure.Data;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace MTWorkHR.Infrastructure.Migrations
+{
+    [DbContext(typeof(HRDataContext))]
+    partial class HRDataContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "8.0.1")
+                .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.AuthLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AuthLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.Company", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("CRNumber")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("CompanyName")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(3);
+
+                    b.Property<string>("CreateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(1);
+
+                    b.Property<bool>("IsDeleted")
+                        .HasColumnType("bit");
+
+                    b.Property<int>("TaxNumber")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime?>("UpdateDate")
+                        .HasColumnType("datetime2")
+                        .HasColumnOrder(4);
+
+                    b.Property<string>("UpdateUser")
+                        .HasMaxLength(450)
+                        .HasColumnType("nvarchar(450)")
+                        .HasColumnOrder(2);
+
+                    b.Property<long>("UserId")
+                        .HasColumnType("bigint");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Companies");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.FileLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("FileLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.RoleLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("RoleLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.SettingLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("SettingLogs");
+                });
+
+            modelBuilder.Entity("MTWorkHR.Core.Entities.UserLog", b =>
+                {
+                    b.Property<long>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("bigint")
+                        .HasColumnOrder(0);
+
+                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
+
+                    b.Property<string>("Channel")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<DateTime>("CreateDate")
+                        .HasColumnType("datetime2");
+
+                    b.Property<string>("CreateUser")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorCode")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ErrorDescription")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("InnerException")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Input")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("Method")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("QueryString")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServerIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("ServiceResponseTimeInSeconds")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("UserIP")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.Property<string>("userAgent")
+                        .IsRequired()
+                        .HasColumnType("nvarchar(max)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("UserLogs");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 3 - 3
MTWorkHR.Infrastructure/UnitOfWork/UnitOfWork.cs

@@ -14,18 +14,18 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
         private readonly HRDataContext context;
 
         public IPermissionRepository Permission { get; }
-        //public ICompanyRepository Company { get; }
+        public ICompanyRepository Company { get; }
 
 
         public UnitOfWork(HRDataContext _context
             , IPermissionRepository Permission
-            //, ICompanyRepository Company
+            , ICompanyRepository Company
             )
         {
             context = _context;
 
             this.Permission = Permission;
-            //this.Company = Company;
+            this.Company = Company;
 		}
 
         public async Task<int> CompleteAsync()

+ 4 - 6
MTWorkHR.Infrastructure/UnitOfWork/UnitOfWorkLog.cs

@@ -15,29 +15,27 @@ namespace MTWorkHR.Infrastructure.UnitOfWorks
     {
         private readonly HRDataContext context;
         public IRepositoryLog<UserLog> UserLog { get; }
-        public IRepositoryLog<AuthenticateLog> AuthenticateLog { get; }
+        public IRepositoryLog<AuthLog> AuthLog { get; }
         public IRepositoryLog<FileLog> FileLog { get; }
         public IRepositoryLog<RoleLog> RoleLog { get; }
         public IRepositoryLog<SettingLog> SettingLog { get; }
-		public IRepositoryLog<SmsLog> SmsLog { get; }
+
 
         public UnitOfWorkLog(HRDataContext _context
             , IRepositoryLog<UserLog> userLog
-            , IRepositoryLog<AuthenticateLog> authenticateLog
+            , IRepositoryLog<AuthLog> authenticateLog
             , IRepositoryLog<FileLog> FileLog
             , IRepositoryLog<RoleLog> RoleLog
             , IRepositoryLog<SettingLog> settingLog
-            , IRepositoryLog<SmsLog> SmsLog
             )
         {
             context = _context;
 
             UserLog = userLog;
-            AuthenticateLog = authenticateLog;
+            AuthLog = authenticateLog;
             this.FileLog = FileLog;
             this.RoleLog = RoleLog;
             this.SettingLog = settingLog;
-            this.SmsLog = SmsLog;
 		}
 
         public async Task<int> CompleteAsync()