Initial commit - Auth
This commit is contained in:
Executable
+84
@@ -0,0 +1,84 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
using Auth.Contracts.DTOs.Users;
|
||||
// using Contracts.DTOs.Users;
|
||||
// using Domain.Entities.HR;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Auth.Domain.Entities.HR;
|
||||
|
||||
public class AppUser : IdentityUser
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string PhotoPath { get; set; }
|
||||
|
||||
public int Holidays { get; set; } = 0;
|
||||
|
||||
public double locationLong { get; set; }
|
||||
public double locationLati { get; set; }
|
||||
|
||||
// public string? Country { get; set; }
|
||||
// public string? City { get; set; }
|
||||
public string? Street { get; set; }
|
||||
public string Building { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public int? Floor { get; set; }
|
||||
public int? Flat { get; set; }
|
||||
|
||||
public string? Department { get; set; }
|
||||
|
||||
public string? JobTitle { get; set; }
|
||||
|
||||
public double? SalaryAmount { get; set; }
|
||||
|
||||
// public ICollection<Salary> Salaries { get; set; }
|
||||
|
||||
// public string? CartId { get; set; }
|
||||
|
||||
// public Order? Cart { get; set; }
|
||||
|
||||
// public bool? EmailConfirmed { get; set; }
|
||||
|
||||
|
||||
public string? RefreshToken { get; set; }
|
||||
|
||||
public DateTime? RefreshTokenExpiryDate { get; set; }
|
||||
|
||||
// public List<string> Roles { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual List<string> Favorites { get; set; } = new();
|
||||
|
||||
// public ICollection<Order> Orders { get; set; }
|
||||
|
||||
|
||||
public static AppUser ToEntity(UserVM userVM)
|
||||
{
|
||||
return new AppUser
|
||||
{
|
||||
Id = userVM.Id,
|
||||
Name = userVM.Name,
|
||||
PhoneNumber = userVM.PhoneNumber,
|
||||
PhotoPath = userVM.PhotoPath,
|
||||
Email = userVM.Email,
|
||||
// JobTitle = userVM.JobTitle,
|
||||
// Holidays = userVM.Holidays,
|
||||
// Roles = userVM.Roles,
|
||||
};
|
||||
}
|
||||
|
||||
public static UserVM ToVM(AppUser appUser)
|
||||
{
|
||||
return new UserVM()
|
||||
{
|
||||
Id = appUser.Id,
|
||||
Name = appUser.Name,
|
||||
PhoneNumber = appUser.PhoneNumber,
|
||||
PhotoPath = appUser.PhotoPath,
|
||||
Email = appUser.Email,
|
||||
// Holidays = appUser.Holidays,
|
||||
// Roles = appUser.Roles,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities.Emails;
|
||||
|
||||
public class EmailTemplate
|
||||
{
|
||||
public Guid Id {get; set;}
|
||||
|
||||
public string Name {get; set;}
|
||||
|
||||
public ICollection<string> Tags {get; set;}
|
||||
|
||||
public string Category {get; set;}
|
||||
|
||||
public string HTMLTemplate {get; set;}
|
||||
|
||||
public string Values { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Domain.Entities.Emails;
|
||||
|
||||
public class SenderCredentials
|
||||
{
|
||||
public Guid Id {get; set;}
|
||||
|
||||
public Guid Email {get; set;}
|
||||
public Guid Password {get; set;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
|
||||
// namespace Auth.Domain.Entities.HR;
|
||||
|
||||
// public class Punch
|
||||
// {
|
||||
// public Guid Id { get; set; }
|
||||
// public string EmployeeId { get; set; }
|
||||
// public AppUser Employee { get; set; }
|
||||
// public DateTime DateTime { get; set; }
|
||||
// public bool IsAttendant { get; set; }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Auth.Domain.Entities.HR;
|
||||
|
||||
public class Rule { }
|
||||
@@ -0,0 +1,44 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
// using Contracts.DTOs.HR;
|
||||
|
||||
// namespace Auth.Domain.Entities.HR;
|
||||
|
||||
// public class Salary
|
||||
// {
|
||||
// public Guid Id { get; set; }
|
||||
|
||||
// public double Amount { get; set; }
|
||||
|
||||
// public DateTime StartDate { get; set; }
|
||||
|
||||
// public DateTime? EndDate { get; set; }
|
||||
|
||||
// public string EmployeeName { get; set; }
|
||||
// public string EmployeeId { get; set; }
|
||||
// public AppUser Employee { get; set; }
|
||||
|
||||
// public static SalaryVM ToVM(Salary salary)
|
||||
// {
|
||||
// return new SalaryVM()
|
||||
// {
|
||||
// Amount = salary.Amount,
|
||||
// EmployeeId = salary.EmployeeId,
|
||||
// StartDate = salary.StartDate,
|
||||
// EndDate = salary.EndDate,
|
||||
// };
|
||||
// }
|
||||
|
||||
// public static Salary ToEntity(SalaryVM salaryVM)
|
||||
// {
|
||||
// return new Salary()
|
||||
// {
|
||||
// Amount = salaryVM.Amount,
|
||||
// EmployeeId = salaryVM.EmployeeId,
|
||||
// StartDate = salaryVM.StartDate,
|
||||
// EndDate = salaryVM.EndDate,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,120 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
// using Contracts;
|
||||
// using Contracts.DTOs.Requests;
|
||||
|
||||
// namespace Auth.Domain.Entities;
|
||||
|
||||
// public class Request
|
||||
// {
|
||||
// public Guid Id { get; set; }
|
||||
|
||||
// public AppEnum.RequestType? RequestType { get; set; }
|
||||
|
||||
// public string Title { get; set; }
|
||||
|
||||
// public string Description { get; set; }
|
||||
|
||||
// // Punch properties
|
||||
// public DateTime? PunchDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// public TimeSpan? PunchTime { get; set; } = DateTime.UtcNow.TimeOfDay;
|
||||
|
||||
// public bool? IsAttend { get; set; } = true;
|
||||
|
||||
// // Leave permission properties
|
||||
// public DateTime? PermissionDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// public TimeSpan? PermissionTime { get; set; } = DateTime.UtcNow.TimeOfDay;
|
||||
|
||||
// public bool? IsLeaveEarly { get; set; } = true;
|
||||
|
||||
// // Absence permission properties
|
||||
// public DateTime? AbsenceDate { get; set; } = DateTime.UtcNow;
|
||||
|
||||
// public bool? IsFromHolidays { get; set; } = false;
|
||||
|
||||
// // Financial properties
|
||||
// public AppEnum.FinancialType? FinancialType { get; set; }
|
||||
// public AppEnum.RequestStatus? RequestStatus { get; set; }
|
||||
|
||||
// public decimal? Amount { get; set; }
|
||||
|
||||
// public string IssuerId { get; set; }
|
||||
// public AppUser? Issuer { get; set; }
|
||||
|
||||
// public string? AcceptedById { get; set; }
|
||||
// public AppUser? AcceptedBy { get; set; }
|
||||
|
||||
// public DateTime? DateRequestCreated { get; set; } = DateTime.UtcNow;
|
||||
// public DateTime? DateRequestTreated { get; set; }
|
||||
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return $"Request Type: {RequestType}\n"
|
||||
// + $"Punch Date: {PunchDate}\n"
|
||||
// + $"Punch Time: {PunchTime}\n"
|
||||
// + $"Is Attend: {IsAttend}\n"
|
||||
// + $"Permission Date: {PermissionDate}\n"
|
||||
// + $"Permission Time: {PermissionTime}\n"
|
||||
// + $"Is Leave Early: {IsLeaveEarly}\n"
|
||||
// + $"Absence Date: {AbsenceDate}\n"
|
||||
// + $"Is From Holidays: {IsFromHolidays}\n"
|
||||
// + $"Financial Type: {FinancialType}\n"
|
||||
// + $"Amount: {Amount}";
|
||||
// }
|
||||
|
||||
// public static Request ToEntity(RequestVM requestVM)
|
||||
// {
|
||||
// return new Request
|
||||
// {
|
||||
// Id = requestVM.Id,
|
||||
// RequestType = requestVM.RequestType,
|
||||
// Title = requestVM.Title,
|
||||
// Description = requestVM.Description,
|
||||
// PunchDate = requestVM.PunchDate,
|
||||
// PunchTime = requestVM.PunchTime,
|
||||
// IsAttend = requestVM.IsAttend,
|
||||
// PermissionDate = requestVM.PermissionDate,
|
||||
// PermissionTime = requestVM.PermissionTime,
|
||||
// IsLeaveEarly = requestVM.IsLeaveEarly,
|
||||
// AbsenceDate = requestVM.AbsenceDate,
|
||||
// IsFromHolidays = requestVM.IsFromHolidays,
|
||||
// FinancialType = requestVM.FinancialType,
|
||||
// Amount = requestVM.Amount,
|
||||
// IssuerId = requestVM.IssuerId,
|
||||
// AcceptedById = requestVM.AcceptedById,
|
||||
// DateRequestCreated = DateTime.UtcNow,
|
||||
// DateRequestTreated = requestVM.DateRequestTreated,
|
||||
// };
|
||||
// }
|
||||
|
||||
// public static RequestVM ToVM(Request request)
|
||||
// {
|
||||
// return new RequestVM()
|
||||
// {
|
||||
// Id = request.Id,
|
||||
// RequestType = request.RequestType.Value,
|
||||
// Title = request.Title,
|
||||
// Description = request.Description,
|
||||
// PunchDate = request.PunchDate,
|
||||
// PunchTime = request.PunchTime,
|
||||
// IsAttend = request.IsAttend,
|
||||
// PermissionDate = request.PermissionDate,
|
||||
// PermissionTime = request.PermissionTime,
|
||||
// IsLeaveEarly = request.IsLeaveEarly,
|
||||
// AbsenceDate = request.AbsenceDate,
|
||||
// IsFromHolidays = request.IsFromHolidays,
|
||||
// FinancialType = request.FinancialType.Value,
|
||||
// Amount = request.Amount,
|
||||
// IssuerId = request.IssuerId,
|
||||
// Issuer = AppUser.ToVM(request.Issuer),
|
||||
// AcceptedById = request.AcceptedById,
|
||||
// AcceptedBy = AppUser.ToVM(request.AcceptedBy),
|
||||
// DateRequestCreated = request.DateRequestCreated,
|
||||
// DateRequestTreated = request.DateRequestTreated,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Auth.Domain.Entities;
|
||||
|
||||
public class Role : IdentityRole {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// using System;
|
||||
// using System.Collections.Generic;
|
||||
// using System.ComponentModel.DataAnnotations.Schema;
|
||||
// using System.Linq;
|
||||
// using System.Threading.Tasks;
|
||||
|
||||
// namespace Auth.Domain.Entities;
|
||||
|
||||
// public class UploadedFile
|
||||
// {
|
||||
// public Guid Id { get; set; }
|
||||
|
||||
// public string Type { get; set; }
|
||||
|
||||
// public string Extension { get; set; }
|
||||
|
||||
// public string Name { get; set; }
|
||||
|
||||
|
||||
|
||||
// [NotMapped]
|
||||
// public string? Content64 { get; set; }
|
||||
|
||||
// [NotMapped]
|
||||
// public byte[]? Content { get; set; }
|
||||
|
||||
// public string? UploadLink { get; set; }
|
||||
|
||||
// }
|
||||
Reference in New Issue
Block a user