Files
icarus/Models/User.cs
T
Kun Deng 270b7d059c #90: Adding functionality to download cover art (#97)
* Added endpoint to download cover art

* Code cleanup

* More cleanup
2024-06-16 18:28:08 -04:00

55 lines
1.6 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace Icarus.Models;
[Table("User")]
public class User
{
#region Properties
[JsonProperty("user_id")]
[Column("UserID")]
[Key]
public int UserID { get; set; }
[JsonProperty("username")]
public string Username { get; set; }
[JsonProperty("password")]
public string Password { get; set; }
[JsonProperty("email")]
public string Email { get; set; }
[JsonProperty("phone")]
[Column("Phone")]
public string Phone { get; set; }
[JsonProperty("firstname")]
public string Firstname { get; set; }
[JsonProperty("lastname")]
public string Lastname { get; set; }
[JsonProperty("email_verified")]
[NotMapped]
public bool EmailVerified { get; set; }
[JsonProperty("date_created")]
public DateTime DateCreated { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("last_login")]
public DateTime? LastLogin { get; set; }
[JsonIgnore]
[NotMapped]
public System.Collections.Generic.IEnumerable<string> Roles { get; set; }
#endregion
#region Methods
public System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims()
{
var claims = new System.Collections.Generic.List<System.Security.Claims.Claim> { new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, Username) };
claims.AddRange(Roles.Select(role => new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role)));
return claims;
}
#endregion
}