zeroframework/Services/Identity/ZeroFramework.IdentityServer.API/Validations/Tenants/TenantCreateRequestModelValidator.cs

17 lines
777 B
C#
Raw Permalink Normal View History

2023-12-05 09:22:48 +00:00
using FluentValidation;
using ZeroFramework.IdentityServer.API.Models.Tenants;
namespace ZeroFramework.IdentityServer.API.Validations.Tenants
{
public class TenantCreateRequestModelValidator : AbstractValidator<TenantCreateRequestModel>
{
public TenantCreateRequestModelValidator(ILogger<TenantCreateRequestModelValidator> logger)
{
logger.LogInformation(nameof(TenantCreateRequestModelValidator));
RuleFor(e => e.Name).NotNull().NotEmpty().Length(5, 15).Matches("^[a-z]+$");
RuleFor(e => e.AdminUserName).NotNull().NotEmpty().Length(5, 15);
RuleFor(e => e.AdminPassword).NotNull().NotEmpty().Length(5, 15);
RuleFor(e => e.DisplayName).NotNull().NotEmpty().Length(5, 15);
}
}
}