22 lines
685 B
C#
22 lines
685 B
C#
using FluentValidation;
|
|
using TakeoutSaaS.Application.App.SystemParameters.Commands;
|
|
|
|
namespace TakeoutSaaS.Application.App.SystemParameters.Validators;
|
|
|
|
/// <summary>
|
|
/// 创建系统参数命令验证器。
|
|
/// </summary>
|
|
public sealed class CreateSystemParameterCommandValidator : AbstractValidator<CreateSystemParameterCommand>
|
|
{
|
|
/// <summary>
|
|
/// 初始化验证规则。
|
|
/// </summary>
|
|
public CreateSystemParameterCommandValidator()
|
|
{
|
|
RuleFor(x => x.Key).NotEmpty().MaximumLength(128);
|
|
RuleFor(x => x.Value).NotEmpty();
|
|
RuleFor(x => x.Description).MaximumLength(512);
|
|
RuleFor(x => x.SortOrder).GreaterThanOrEqualTo(0);
|
|
}
|
|
}
|