From 32fdf425e6b4f4edfb727fb3c0cbebe2c87fd663 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 20 Aug 2020 00:39:09 +0800 Subject: ... --- Timeline/Models/Http/UserController.cs | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'Timeline/Models/Http/UserController.cs') diff --git a/Timeline/Models/Http/UserController.cs b/Timeline/Models/Http/UserController.cs index 5ee02a95..ea30a0ea 100644 --- a/Timeline/Models/Http/UserController.cs +++ b/Timeline/Models/Http/UserController.cs @@ -1,48 +1,95 @@ using AutoMapper; using System.ComponentModel.DataAnnotations; +using Timeline.Controllers; using Timeline.Models.Validation; namespace Timeline.Models.Http { + /// + /// Request model for . + /// public class UserPatchRequest { + /// + /// New username. Null if not change. Need to be administrator. + /// [Username] public string? Username { get; set; } + /// + /// New password. Null if not change. Need to be administrator. + /// [MinLength(1)] public string? Password { get; set; } + /// + /// New nickname. Null if not change. Need to be administrator to change other's. + /// [Nickname] public string? Nickname { get; set; } + /// + /// Whether to be administrator. Null if not change. Need to be administrator. + /// public bool? Administrator { get; set; } } + /// + /// Request model for . + /// public class CreateUserRequest { + /// + /// Username of the new user. + /// [Required, Username] public string Username { get; set; } = default!; + /// + /// Password of the new user. + /// [Required, MinLength(1)] public string Password { get; set; } = default!; + /// + /// Whether the new user is administrator. + /// [Required] public bool? Administrator { get; set; } + /// + /// Nickname of the new user. + /// [Nickname] public string? Nickname { get; set; } } + /// + /// Request model for . + /// public class ChangePasswordRequest { + /// + /// Old password. + /// [Required(AllowEmptyStrings = false)] public string OldPassword { get; set; } = default!; + + /// + /// New password. + /// [Required(AllowEmptyStrings = false)] public string NewPassword { get; set; } = default!; } + /// + /// + /// public class UserControllerAutoMapperProfile : Profile { + /// + /// + /// public UserControllerAutoMapperProfile() { CreateMap(MemberList.Source); -- cgit v1.2.3