12 lines
440 B
C#
12 lines
440 B
C#
using FluentValidation;
|
|
|
|
public class CreateSiteRequestValidator : AbstractValidator<CreateSiteRequest>
|
|
{
|
|
public CreateSiteRequestValidator()
|
|
{
|
|
RuleFor(x => x.SiteCode).NotEmpty().MaximumLength(32)
|
|
.Matches("^[A-Z0-9-]+$").WithMessage("SiteCode must be uppercase alphanumeric with hyphens.");
|
|
RuleFor(x => x.Name).NotEmpty().MaximumLength(200);
|
|
RuleFor(x => x.Address).MaximumLength(500);
|
|
}
|
|
} |