aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Models/Http/UserController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline/Models/Http/UserController.cs')
-rw-r--r--Timeline/Models/Http/UserController.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/Timeline/Models/Http/UserController.cs b/Timeline/Models/Http/UserController.cs
index 229ca1e5..e4c95cbd 100644
--- a/Timeline/Models/Http/UserController.cs
+++ b/Timeline/Models/Http/UserController.cs
@@ -1,5 +1,7 @@
+using AutoMapper;
using System.ComponentModel.DataAnnotations;
using Timeline.Models.Validation;
+using Timeline.Services;
namespace Timeline.Models.Http
{
@@ -17,6 +19,21 @@ namespace Timeline.Models.Http
public bool? Administrator { get; set; }
}
+ public class CreateUserRequest
+ {
+ [Required, Username]
+ public string Username { get; set; } = default!;
+
+ [Required, MinLength(1)]
+ public string Password { get; set; } = default!;
+
+ [Required]
+ public bool? Administrator { get; set; }
+
+ [Nickname]
+ public string? Nickname { get; set; }
+ }
+
public class ChangePasswordRequest
{
[Required(AllowEmptyStrings = false)]
@@ -24,4 +41,13 @@ namespace Timeline.Models.Http
[Required(AllowEmptyStrings = false)]
public string NewPassword { get; set; } = default!;
}
+
+ public class UserControllerAutoMapperProfile : Profile
+ {
+ public UserControllerAutoMapperProfile()
+ {
+ CreateMap<UserPatchRequest, User>(MemberList.Source);
+ CreateMap<CreateUserRequest, User>(MemberList.Source);
+ }
+ }
}