2024-10-07 18:04:26 -05:00
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
2023-01-02 15:44:04 -06:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2023-01-04 20:00:11 -06:00
|
|
|
|
using System.Text.Json.Serialization;
|
2023-01-02 15:44:04 -06:00
|
|
|
|
|
2024-08-04 18:44:33 -05:00
|
|
|
|
namespace LANCommander.Server.Data.Models
|
2023-01-02 15:44:04 -06:00
|
|
|
|
{
|
|
|
|
|
|
[Table("Users")]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
public class User : IdentityUser<Guid>, IBaseModel
|
2023-01-02 15:44:04 -06:00
|
|
|
|
{
|
2023-01-04 20:00:11 -06:00
|
|
|
|
// Ignore the following properties from leaking into REST requests
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? PasswordHash { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? SecurityStamp { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? Email { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? NormalizedEmail { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override bool EmailConfirmed { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? NormalizedUserName { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? ConcurrencyStamp { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override string? PhoneNumber { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override bool PhoneNumberConfirmed { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override bool TwoFactorEnabled { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override DateTimeOffset? LockoutEnd { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override bool LockoutEnabled { get; set; }
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public override int AccessFailedCount { get; set; }
|
2023-01-04 23:45:11 -06:00
|
|
|
|
|
|
|
|
|
|
// Refresh Token
|
2023-01-05 18:35:33 -06:00
|
|
|
|
[JsonIgnore]
|
2023-01-04 23:45:11 -06:00
|
|
|
|
public string? RefreshToken { get; set; }
|
2023-01-05 18:35:33 -06:00
|
|
|
|
[JsonIgnore]
|
2023-01-04 23:45:11 -06:00
|
|
|
|
public DateTime RefreshTokenExpiration { get; set; }
|
2023-01-17 17:57:12 -06:00
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<GameSave>? GameSaves { get; set; }
|
2023-03-28 21:30:29 -05:00
|
|
|
|
|
2023-11-17 02:28:46 -06:00
|
|
|
|
[JsonIgnore]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<PlaySession>? PlaySessions { get; set; }
|
2023-11-17 02:28:46 -06:00
|
|
|
|
|
2024-01-15 02:20:35 -06:00
|
|
|
|
[JsonIgnore]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<Media>? Media { get; set; }
|
2025-08-28 19:57:23 -05:00
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public ICollection<ChatThread>? ChatThreads { get; set; }
|
2024-01-15 02:20:35 -06:00
|
|
|
|
|
2025-03-09 01:43:12 -06:00
|
|
|
|
public ICollection<UserRole> UserRoles { get; set; }
|
|
|
|
|
|
|
2024-10-16 16:29:55 -05:00
|
|
|
|
[NotMapped]
|
2025-03-09 01:43:12 -06:00
|
|
|
|
public ICollection<Role>? Roles {
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return UserRoles?.Select(x => x.Role).ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public ICollection<UserCustomField>? CustomFields { get; set; }
|
2024-08-21 19:40:27 -05:00
|
|
|
|
|
2023-08-11 13:30:29 -05:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool Approved { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
2023-08-14 20:36:39 -05:00
|
|
|
|
public DateTime? ApprovedOn { get; set; }
|
2023-08-11 13:30:29 -05:00
|
|
|
|
|
2023-10-16 20:48:12 -05:00
|
|
|
|
public string? Alias { get; set; }
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Created On")]
|
2025-04-14 23:52:20 +02:00
|
|
|
|
public DateTime CreatedOn { get; set; } = DateTime.UtcNow;
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-23 01:59:17 -05:00
|
|
|
|
public Guid? CreatedById { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(CreatedById))]
|
|
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Created By")]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public User? CreatedBy { get; set; }
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Updated On")]
|
2025-04-14 23:52:20 +02:00
|
|
|
|
public DateTime UpdatedOn { get; set; } = DateTime.UtcNow;
|
2024-10-15 23:48:16 -05:00
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-23 01:59:17 -05:00
|
|
|
|
public Guid? UpdatedById { get; set; }
|
|
|
|
|
|
[ForeignKey(nameof(UpdatedById))]
|
|
|
|
|
|
|
2024-10-31 01:54:34 -05:00
|
|
|
|
[JsonIgnore]
|
2024-10-15 23:48:16 -05:00
|
|
|
|
[Display(Name = "Updated By")]
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public User? UpdatedBy { get; set; }
|
2024-10-31 01:54:34 -05:00
|
|
|
|
|
2024-11-27 01:51:47 -06:00
|
|
|
|
public Library Library { get; set; }
|
2023-01-02 15:44:04 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|