This commit is contained in:
2023-02-19 00:43:43 +01:00
parent 9719a0c0fd
commit 1e66851113
146 changed files with 738 additions and 382 deletions

View File

@ -0,0 +1,35 @@
using PrivaPub.ClientModels.Resources;
using System.ComponentModel.DataAnnotations;
using System.Security.AccessControl;
using System.Text.Json.Serialization;
using System.Xml.Linq;
namespace PrivaPub.ClientModels.User.Avatar
{
[JsonSerializable(typeof(InsertAvatarForm))]
public class InsertAvatarForm
{
[JsonIgnore]
public string RootId { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(Name), ResourceType = typeof(FieldsNameResource))]
public string Name { get; set; }//name
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(UserName), ResourceType = typeof(FieldsNameResource))]
public string UserName { get; set; }//preferredUsername
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
StringLength(Constants.MaxAvatarBiographyLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(Biography), ResourceType = typeof(FieldsNameResource))]
public string Biography { get; set; }//summary
public ViewAvatarSettings Settings { get; set; } = new();
public Dictionary<string, string> Fields { get; set; } = new();
public string PersonalNote { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using PrivaPub.ClientModels.Resources;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace PrivaPub.ClientModels.User.Avatar
{
[JsonSerializable(typeof(UpdateAvatarForm))]
public class UpdateAvatarForm
{
[JsonIgnore]
public string RootId { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(AvatarId), ResourceType = typeof(FieldsNameResource))]
public string AvatarId { get; set; }
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
StringLength(Constants.MaxAvatarNameLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(Name), ResourceType = typeof(FieldsNameResource))]
public string Name { get; set; }//name
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
StringLength(Constants.MaxAvatarBiographyLength, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(Biography), ResourceType = typeof(FieldsNameResource))]
public string Biography { get; set; }//summary
public ViewAvatarSettings Settings { get; set; } = new();
public Dictionary<string, string> Fields { get; set; } = new();
public string PersonalNote { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using System.Text.Json.Serialization;
namespace PrivaPub.ClientModels.User.Avatar
{
[JsonSerializable(typeof(ViewAvatar))]
public class ViewAvatar
{
public string Url { get; set; }//url
public string Name { get; set; }//name
public string UserName { get; set; }//preferredUsername
public string Biography { get; set; }//summary
public Dictionary<string, string> Fields { get; set; } = new();
public string PictureURL { get; set; }//icon
public string ThumbnailURL { get; set; }//image
public Dictionary<string, string> SharedPersonalContacts { get; set; } = new();
public ViewAvatarState AccountState { get; set; } = ViewAvatarState.Normal;
public ViewAvatarServer ServerType { get; set; } = ViewAvatarServer.Unknown;
public ViewAvatarSettings Settings { get; set; } = new();
public DateTime UpdatedAt { get; set; }
public DateTime CreatedAt { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using PrivaPub.ClientModels.Resources;
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace PrivaPub.ClientModels.User.Avatar
{
[JsonSerializable(typeof(ViewAvatarSettings))]
public class ViewAvatarSettings
{
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
Display(Name = nameof(LanguageCode), ResourceType = typeof(FieldsNameResource))]
public string LanguageCode { get; set; } = "en-GB";
public bool IsDefault { get; set; } = true;
[Range(-2, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
public short IconsThemeIndexColour { get; set; } = 25;
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
public short LightThemeIndexColour { get; set; } = 25;
[Range(0, 359, ErrorMessageResourceName = nameof(Range), ErrorMessageResourceType = typeof(ErrorsResource))]
public short DarkThemeIndexColour { get; set; } = 215;
public bool PreferSystemTheming { get; set; } = true;
public bool ThemeIsDarkMode { get; set; } = false;
public bool ThemeIsLightGray { get; set; } = true;
public bool ThemeIsDarkGray { get; set; } = false;
}
}