namespace BuildFlow.Host.Endpoints.rag.Permissions;
///
/// 更新权限请求校验。
///
public class UpdatePermissionEndpointRequestValidator : Validator
{
public UpdatePermissionEndpointRequestValidator()
{
RuleFor(x => x.Id).NotEmpty().WithMessage("权限 ID 不能为空");
When(x => x.Name is not null, () =>
{
RuleFor(x => x.Name!).Length(2, 50).WithMessage("权限名称长度 2-50 个字符");
});
When(x => x.Description is not null, () =>
{
RuleFor(x => x.Description!).MaximumLength(500).WithMessage("权限描述长度不能超过 500 个字符");
});
When(x => x.Group is not null, () =>
{
RuleFor(x => x.Group!).MaximumLength(50).WithMessage("权限分组长度不能超过 50 个字符");
});
}
}