25 lines
681 B
C#
25 lines
681 B
C#
|
|
using FluentValidation;
|
|||
|
|
|
|||
|
|
namespace lai_transfer.Common.Extensions;
|
|||
|
|
|
|||
|
|
public static class ValidationRulesExtension
|
|||
|
|
{
|
|||
|
|
public static IRuleBuilderOptions<T, string> AuthUsernameRule<T>(
|
|||
|
|
this IRuleBuilderInitial<T, string> rule)
|
|||
|
|
{
|
|||
|
|
return rule.NotEmpty().WithMessage("用户名不能为空");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static IRuleBuilderOptions<T, string> AuthPasswordRule<T>(
|
|||
|
|
this IRuleBuilderInitial<T, string> rule)
|
|||
|
|
{
|
|||
|
|
return rule.NotEmpty().MinimumLength(8);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static IRuleBuilderOptions<T, string> AuthNameRule<T>(
|
|||
|
|
this IRuleBuilderInitial<T, string> rule)
|
|||
|
|
{
|
|||
|
|
return rule.NotEmpty().MaximumLength(50);
|
|||
|
|
}
|
|||
|
|
}
|