Saving
This commit is contained in:
		
							
								
								
									
										35
									
								
								PrivaPub.ClientModels/User/Avatar/InsertAvatarForm.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								PrivaPub.ClientModels/User/Avatar/InsertAvatarForm.cs
									
									
									
									
									
										Normal 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; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								PrivaPub.ClientModels/User/Avatar/UpdateAvatarForm.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								PrivaPub.ClientModels/User/Avatar/UpdateAvatarForm.cs
									
									
									
									
									
										Normal 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; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										26
									
								
								PrivaPub.ClientModels/User/Avatar/ViewAvatar.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								PrivaPub.ClientModels/User/Avatar/ViewAvatar.cs
									
									
									
									
									
										Normal 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; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										29
									
								
								PrivaPub.ClientModels/User/Avatar/ViewAvatarSettings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								PrivaPub.ClientModels/User/Avatar/ViewAvatarSettings.cs
									
									
									
									
									
										Normal 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;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								PrivaPub.ClientModels/User/JwtUser.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								PrivaPub.ClientModels/User/JwtUser.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
namespace PrivaPub.ClientModels.User
 | 
			
		||||
{
 | 
			
		||||
	public class JwtUser
 | 
			
		||||
	{
 | 
			
		||||
		public string UserId { get; set; }
 | 
			
		||||
		public string Username { get; set; }
 | 
			
		||||
		public string Email { get; set; }
 | 
			
		||||
		public List<string> Policies { get; set; } = new();
 | 
			
		||||
		public string Token { get; set; }
 | 
			
		||||
		public long Expiration { get; set; }
 | 
			
		||||
		public ViewAvatarServer UserSettings { get; set; } = new();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										40
									
								
								PrivaPub.ClientModels/User/UserForm.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								PrivaPub.ClientModels/User/UserForm.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
using PrivaPub.ClientModels.Resources;
 | 
			
		||||
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
 | 
			
		||||
namespace PrivaPub.ClientModels.User
 | 
			
		||||
{
 | 
			
		||||
	public class UserForm
 | 
			
		||||
	{
 | 
			
		||||
		[EmailAddress(ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			Display(Name = "Email", ResourceType = typeof(FieldsNameResource))]
 | 
			
		||||
		public string Email { get; set; }
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public class UserPasswordForm
 | 
			
		||||
	{
 | 
			
		||||
		[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			PasswordPropertyText(true),
 | 
			
		||||
			Display(Name = "OldPassword", ResourceType = typeof(FieldsNameResource)),
 | 
			
		||||
			StringLength(Constants.MaxPasswordLength, MinimumLength = Constants.MinPasswordLength, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			RegularExpression(Constants.PasswordRegex, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource))]
 | 
			
		||||
		public string OldPassword { get; set; }
 | 
			
		||||
 | 
			
		||||
		[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			PasswordPropertyText(true),
 | 
			
		||||
			Display(Name = "NewPassword", ResourceType = typeof(FieldsNameResource)),
 | 
			
		||||
			StringLength(Constants.MaxPasswordLength, MinimumLength = Constants.MinPasswordLength, ErrorMessageResourceName = "StringLengthMinMax", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			RegularExpression(Constants.PasswordRegex, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource))]
 | 
			
		||||
		public string NewPassword { get; set; }
 | 
			
		||||
 | 
			
		||||
		[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			DataType(DataType.Password, ErrorMessageResourceName = "InvalidPassword", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			PasswordPropertyText(true),
 | 
			
		||||
			Compare(nameof(NewPassword), ErrorMessageResourceName = "ComparePasswords", ErrorMessageResourceType = typeof(ErrorsResource)),
 | 
			
		||||
			Display(Name = "NewPasswordConfirmation", ResourceType = typeof(FieldsNameResource))]
 | 
			
		||||
		public string RepeatedPassword { get; set; }
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								PrivaPub.ClientModels/User/UsersIds.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								PrivaPub.ClientModels/User/UsersIds.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
namespace PrivaPub.ClientModels.User
 | 
			
		||||
{
 | 
			
		||||
	public class UsersIds
 | 
			
		||||
	{
 | 
			
		||||
		public IList<string> UserIdList { get; set; } = Array.Empty<string>();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								PrivaPub.ClientModels/User/ViewAvatarServer.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								PrivaPub.ClientModels/User/ViewAvatarServer.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
namespace PrivaPub.ClientModels.User
 | 
			
		||||
{
 | 
			
		||||
	public enum ViewAvatarServer
 | 
			
		||||
	{
 | 
			
		||||
		Unknown,
 | 
			
		||||
		Pleroma,
 | 
			
		||||
		Mastodon,
 | 
			
		||||
		Akkoma,
 | 
			
		||||
		Misskey,
 | 
			
		||||
		PrivaPub
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								PrivaPub.ClientModels/User/ViewAvatarState.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								PrivaPub.ClientModels/User/ViewAvatarState.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
namespace PrivaPub.ClientModels.User
 | 
			
		||||
{
 | 
			
		||||
	public enum ViewAvatarState
 | 
			
		||||
	{
 | 
			
		||||
		Normal,
 | 
			
		||||
		Silenced,
 | 
			
		||||
		Suspended,
 | 
			
		||||
		Banned,
 | 
			
		||||
		Deleted
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user