服务器部署测试~~~
This commit is contained in:
18
Validators/RegisterRequestValidator.cs
Normal file
18
Validators/RegisterRequestValidator.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using FluentValidation;
|
||||
using SimpleTodoApiWithPg.Models;
|
||||
|
||||
|
||||
public class RegisterRequestValidator : AbstractValidator<RegisterRequest>
|
||||
{
|
||||
public RegisterRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.Username)
|
||||
.NotEmpty().WithMessage("用户名是必填的。")
|
||||
.Length(3, 20).WithMessage("用户名长度必须在 {MinLength} 到 {MaxLength} 之间。");
|
||||
|
||||
RuleFor(x => x.Email)
|
||||
.NotEmpty().WithMessage("邮箱是必填的。")
|
||||
.EmailAddress().WithMessage("请输入有效的邮箱地址。");
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user