Files
mixtape/Finch/Numbers/NumberValidator.cs
T

15 lines
440 B
C#
Raw Normal View History

2022-12-20 15:22:02 +01:00
using FluentValidation;
2026-04-07 14:23:29 +02:00
namespace Finch.Numbers;
2022-12-20 15:22:02 +01:00
2026-04-07 14:23:29 +02:00
public class NumberValidator : FinchValidator<Number>
2022-12-20 15:22:02 +01:00
{
public NumberValidator()
{
RuleFor(x => x.Template).NotEmpty().Length(2, 60);
2023-06-16 17:28:24 +02:00
RuleFor(x => x.Template).Must(x => x != null && x.Contains("{number}"));
2022-12-20 15:22:02 +01:00
RuleFor(x => x.StartNumber).GreaterThanOrEqualTo(0);
RuleFor(x => x.MinLength).ExclusiveBetween(1, 32);
2023-06-16 17:28:24 +02:00
RuleFor(x => x.Step).GreaterThanOrEqualTo(1);
2022-12-20 15:22:02 +01:00
}
}