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);
CreateMap(MemberList.Source);
}
}
}