roadie/Roadie.Api.Library/Models/Users/User.cs

76 lines
2.6 KiB
C#
Raw Normal View History

2018-11-06 21:55:31 +00:00
using Mapster;
2019-01-10 23:40:04 +00:00
using Roadie.Library.Models.Statistics;
2018-11-06 21:55:31 +00:00
using System;
2018-12-16 23:37:19 +00:00
using System.ComponentModel.DataAnnotations;
2018-12-17 00:08:55 +00:00
using System.ComponentModel.DataAnnotations.Schema;
2018-11-06 02:41:51 +00:00
namespace Roadie.Library.Models.Users
{
[Serializable]
public class User
2018-12-16 23:37:19 +00:00
{
2018-11-12 00:28:37 +00:00
public const string ActionKeyUserRated = "__userrated__";
2019-07-03 16:21:29 +00:00
public const string DefaultIncludes = "stats";
[MaxLength(100)] public string ApiToken { get; set; }
2018-12-16 23:37:19 +00:00
public Image Avatar { get; set; }
/// <summary>
2019-07-03 16:21:29 +00:00
/// Posted image from a client of selected new base64 encoded avatar for the user
2018-12-16 23:37:19 +00:00
/// </summary>
public string AvatarData { get; set; }
2019-07-03 16:21:29 +00:00
[Required] [MaxLength(100)] public string ConcurrencyStamp { get; set; }
2018-12-16 23:37:19 +00:00
public bool DoUseHtmlPlayer { get; set; }
[Required]
[MaxLength(100)]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
2019-07-03 16:21:29 +00:00
[MaxLength(500)] public string FtpDirectory { get; set; }
2018-12-16 23:37:19 +00:00
2019-07-03 16:21:29 +00:00
[MaxLength(500)] public string FtpPassword { get; set; }
2018-12-16 23:37:19 +00:00
2019-07-03 16:21:29 +00:00
[MaxLength(250)] public string FtpUrl { get; set; }
2018-12-16 23:37:19 +00:00
2019-07-03 16:21:29 +00:00
[MaxLength(50)] public string FtpUsername { get; set; }
2018-12-16 23:37:19 +00:00
public int? Id { get; set; }
2018-11-06 21:55:31 +00:00
public bool IsAdmin { get; set; }
2018-12-16 23:37:19 +00:00
public bool IsEditor { get; set; }
public bool IsPrivate { get; set; }
2018-12-17 00:08:55 +00:00
/// <summary>
2019-07-03 16:21:29 +00:00
/// Posted password only used when changing password from profile edits
2018-12-17 00:08:55 +00:00
/// </summary>
[NotMapped]
[AdaptIgnore]
public string Password { get; set; }
/// <summary>
2019-07-03 16:21:29 +00:00
/// Posted password confirmation only used when changing password from profile edits
2018-12-17 00:08:55 +00:00
/// </summary>
[NotMapped]
[AdaptIgnore]
public string PasswordConfirmation { get; set; }
2019-07-03 16:21:29 +00:00
public short? PlayerTrackLimit { get; set; }
[MaxLength(65535)] public string Profile { get; set; }
public short? RandomReleaseLimit { get; set; }
public short? RecentlyPlayedLimit { get; set; }
public bool RemoveTrackFromQueAfterPlayed { get; set; }
[NotMapped] [AdaptIgnore] public UserStatistics Statistics { get; set; }
[StringLength(50)] [Required] public string Timeformat { get; set; }
[MaxLength(50)] [Required] public string Timezone { get; set; }
[AdaptMember("RoadieId")] public Guid UserId { get; set; }
[Required] [MaxLength(20)] public string UserName { get; set; }
2019-01-10 23:40:04 +00:00
2018-11-11 20:45:44 +00:00
public override string ToString()
{
2019-07-03 16:21:29 +00:00
return $"Id [{Id}], RoadieId [{UserId}], UserName [{UserName}]";
2018-11-11 20:45:44 +00:00
}
2018-11-06 02:41:51 +00:00
}
}