57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using DbController;
|
|
|
|
namespace Tabletop.Core.Models
|
|
{
|
|
public sealed class User : IDbModel<int?>
|
|
{
|
|
[CompareField("user_id")]
|
|
public int UserId { get; set; }
|
|
[CompareField("username")]
|
|
public string Username { get; set; } = string.Empty;
|
|
[CompareField("display_name")]
|
|
public string DisplayName { get; set; } = string.Empty;
|
|
[CompareField("description")]
|
|
public string Description { get; set; } = string.Empty;
|
|
[CompareField("main_fraction_id")]
|
|
public int MainFractionId { get; set; }
|
|
[CompareField("password")]
|
|
public string Password { get; set; } = string.Empty;
|
|
[CompareField("salt")]
|
|
public string Salt { get; set; } = string.Empty;
|
|
[CompareField("last_login")]
|
|
public DateTime LastLogin { get; set; }
|
|
[CompareField("registration_date")]
|
|
public DateTime RegistrationDate { get; set; }
|
|
[CompareField("image")]
|
|
public byte[]? Image { get; set; }
|
|
|
|
public string ConvertedImage { get; set; } = string.Empty;
|
|
|
|
|
|
public List<Permission> Permissions { get; set; } = [];
|
|
public List<Unit> Units { get; set; } = [];
|
|
|
|
public int? GetIdentifier()
|
|
{
|
|
return UserId > 0 ? UserId : null;
|
|
}
|
|
|
|
public Dictionary<string, object?> GetParameters()
|
|
{
|
|
return new Dictionary<string, object?>
|
|
{
|
|
{ "USER_ID", UserId },
|
|
{ "USERNAME", Username },
|
|
{ "DISPLAY_NAME", DisplayName },
|
|
{ "DESCRIPTION", Description },
|
|
{ "MAIN_FRACTION_ID", MainFractionId },
|
|
{ "PASSWORD", Password },
|
|
{ "SALT", Salt },
|
|
{ "LAST_LOGIN", LastLogin },
|
|
{ "REGISTRATION_DATE", RegistrationDate },
|
|
{ "IMAGE", Image }
|
|
};
|
|
}
|
|
}
|
|
}
|