2024-08-04 18:44:33 -05:00
|
|
|
|
using LANCommander.Server.Services;
|
2023-09-13 19:32:36 -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")]
|
2023-01-03 01:06:48 -06:00
|
|
|
|
public class User : IdentityUser<Guid>
|
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]
|
|
|
|
|
|
public virtual ICollection<GameSave>? GameSaves { get; set; }
|
2023-03-28 21:30:29 -05:00
|
|
|
|
|
2023-11-17 02:28:46 -06:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public virtual ICollection<PlaySession>? PlaySessions { get; set; }
|
|
|
|
|
|
|
2024-01-15 02:20:35 -06:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public virtual ICollection<Media>? Media { get; set; }
|
|
|
|
|
|
|
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; }
|
|
|
|
|
|
|
2023-03-28 21:30:29 -05:00
|
|
|
|
public string GetGameSaveUploadPath()
|
|
|
|
|
|
{
|
2023-09-13 19:32:36 -05:00
|
|
|
|
var settings = SettingService.GetSettings();
|
|
|
|
|
|
|
|
|
|
|
|
return Path.Combine(settings.UserSaves.StoragePath, Id.ToString());
|
2023-03-28 21:30:29 -05:00
|
|
|
|
}
|
2023-01-02 15:44:04 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|