mirror of
https://github.com/azaion/admin.git
synced 2026-04-22 06:56:32 +00:00
74f5594b0c
Made-with: Cursor
23 lines
866 B
C#
23 lines
866 B
C#
using Azaion.Common.Entities;
|
|
using FluentValidation;
|
|
|
|
namespace Azaion.Common.Requests;
|
|
|
|
public class RegisterUserRequest
|
|
{
|
|
public string Email { get; set; } = null!;
|
|
public string Password { get; set; } = null!;
|
|
public RoleEnum Role { get; set; }
|
|
}
|
|
|
|
public class RegisterUserValidator : AbstractValidator<RegisterUserRequest>
|
|
{
|
|
public RegisterUserValidator()
|
|
{
|
|
RuleFor(r => r.Email)
|
|
.NotEmpty().WithErrorCode(ExceptionEnum.EmailLengthIncorrect.ToString()).WithMessage("Email address is required.")
|
|
.EmailAddress().WithErrorCode(ExceptionEnum.WrongEmail.ToString()).WithMessage("Email address is not valid.");
|
|
|
|
RuleFor(r => r.Password)
|
|
.MinimumLength(12).WithErrorCode(ExceptionEnum.PasswordLengthIncorrect.ToString()).WithMessage("Password should be at least 12 characters.");
|
|
} } |