2024-10-29 00:40:58 +04:00
|
|
|
|
using Cloud.Requests;
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
|
|
|
|
|
namespace Cloud.Validation
|
|
|
|
|
{
|
2024-11-12 19:18:37 +04:00
|
|
|
|
public class FarmValidator : AbstractValidator<FarmRequest>
|
|
|
|
|
{
|
|
|
|
|
public FarmValidator()
|
|
|
|
|
{
|
|
|
|
|
RuleFor(request => request.RaspberryIP)
|
|
|
|
|
.NotEmpty().WithMessage("IP address can't be empty")
|
|
|
|
|
.Matches(@"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$").WithMessage("IP address is not valid");
|
2024-10-29 00:40:58 +04:00
|
|
|
|
|
2024-11-12 19:18:37 +04:00
|
|
|
|
RuleFor(request => request.Name)
|
|
|
|
|
.NotEmpty().WithMessage("Name can't be empty");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|