Files
Auth/Auth.Domain/Entities/AppUser.cs
T
2026-08-05 21:15:14 +03:00

85 lines
2.2 KiB
C#
Executable File

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,
};
}
}