Add initial implementation of API, database, and user management components.
This commit is contained in:
38
MikrocopApi/Dtos/CreateUserDto.cs
Normal file
38
MikrocopApi/Dtos/CreateUserDto.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class CreateUserDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, MinimumLength = 3)]
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(200, MinimumLength = 2)]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[StringLength(200)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(30, MinimumLength = 7)]
|
||||
[RegularExpression(@"^\+?[0-9\- ]+$", ErrorMessage = "Mobile number contains invalid characters.")]
|
||||
public string MobileNumber { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(10, MinimumLength = 2)]
|
||||
[RegularExpression(@"^[a-zA-Z]{2,10}$", ErrorMessage = "Language must contain only letters.")]
|
||||
public string Language { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(20, MinimumLength = 2)]
|
||||
[RegularExpression(@"^[a-zA-Z]{2,10}(-[a-zA-Z]{2,10})?$", ErrorMessage = "Culture format is invalid.")]
|
||||
public string Culture { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(128, MinimumLength = 8)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
14
MikrocopApi/Dtos/LoginRequestDto.cs
Normal file
14
MikrocopApi/Dtos/LoginRequestDto.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class LoginRequestDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, MinimumLength = 3)]
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(128, MinimumLength = 8)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
8
MikrocopApi/Dtos/LoginResponseDto.cs
Normal file
8
MikrocopApi/Dtos/LoginResponseDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class LoginResponseDto
|
||||
{
|
||||
public required string AccessToken { get; init; }
|
||||
public required DateTime ExpiresAtUtc { get; init; }
|
||||
public required string TokenType { get; init; }
|
||||
}
|
||||
37
MikrocopApi/Dtos/UpdateUserDto.cs
Normal file
37
MikrocopApi/Dtos/UpdateUserDto.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class UpdateUserDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, MinimumLength = 3)]
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(200, MinimumLength = 2)]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
[StringLength(200)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(30, MinimumLength = 7)]
|
||||
[RegularExpression(@"^\+?[0-9\- ]+$", ErrorMessage = "Mobile number contains invalid characters.")]
|
||||
public string MobileNumber { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(10, MinimumLength = 2)]
|
||||
[RegularExpression(@"^[a-zA-Z]{2,10}$", ErrorMessage = "Language must contain only letters.")]
|
||||
public string Language { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[StringLength(20, MinimumLength = 2)]
|
||||
[RegularExpression(@"^[a-zA-Z]{2,10}(-[a-zA-Z]{2,10})?$", ErrorMessage = "Culture format is invalid.")]
|
||||
public string Culture { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(128, MinimumLength = 8)]
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
12
MikrocopApi/Dtos/UserDto.cs
Normal file
12
MikrocopApi/Dtos/UserDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class UserDto
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public required string UserName { get; init; }
|
||||
public required string FullName { get; init; }
|
||||
public required string Email { get; init; }
|
||||
public required string MobileNumber { get; init; }
|
||||
public required string Language { get; init; }
|
||||
public required string Culture { get; init; }
|
||||
}
|
||||
10
MikrocopApi/Dtos/ValidatePasswordRequestDto.cs
Normal file
10
MikrocopApi/Dtos/ValidatePasswordRequestDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class ValidatePasswordRequestDto
|
||||
{
|
||||
[Required]
|
||||
[StringLength(128, MinimumLength = 8)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
6
MikrocopApi/Dtos/ValidatePasswordResponseDto.cs
Normal file
6
MikrocopApi/Dtos/ValidatePasswordResponseDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace MikrocopApi.Dtos;
|
||||
|
||||
public sealed class ValidatePasswordResponseDto
|
||||
{
|
||||
public bool IsValid { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user