using FluentValidation;
using BuildFlow.Application.Auth.Commands;
namespace BuildFlow.Application.Auth.Validators;
///
/// 登录Command的请求校验器(FluentValidation)。
///
public class LoginCommandValidator : AbstractValidator
{
public LoginCommandValidator()
{
RuleFor(x => x.Username).NotEmpty().WithMessage("用户名不能为空")
.MaximumLength(50).WithMessage("用户名长度不能超过 50 个字符")
.Must(u => u == u.Trim()).WithMessage("用户名前后不能有空格");
RuleFor(x => x.Password).NotEmpty().WithMessage("密码不能为空")
.MaximumLength(100).WithMessage("密码长度不能超过 100 个字符");
}
}