Generator Changes at 9/27/2025 11:07:17 PM

This commit is contained in:
MeysamMoghaddam
2025-09-27 23:48:41 +03:30
parent 447e580a8a
commit a1b6e28d35
45 changed files with 1320 additions and 18 deletions
@@ -0,0 +1,21 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace CMSMicroservice.Protobuf.Validator.OtpToken;
public class CreateNewOtpTokenRequestValidator : AbstractValidator<CreateNewOtpTokenRequest>
{
public CreateNewOtpTokenRequestValidator()
{
RuleFor(model => model.Mobile)
.NotEmpty();
RuleFor(model => model.Purpose)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewOtpTokenRequest>.CreateWithOptions((CreateNewOtpTokenRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,17 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace CMSMicroservice.Protobuf.Validator.OtpToken;
public class GetAllOtpTokenByFilterRequestValidator : AbstractValidator<GetAllOtpTokenByFilterRequest>
{
public GetAllOtpTokenByFilterRequestValidator()
{
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetAllOtpTokenByFilterRequest>.CreateWithOptions((GetAllOtpTokenByFilterRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -0,0 +1,23 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace CMSMicroservice.Protobuf.Validator.OtpToken;
public class VerifyOtpTokenRequestValidator : AbstractValidator<VerifyOtpTokenRequest>
{
public VerifyOtpTokenRequestValidator()
{
RuleFor(model => model.Mobile)
.NotEmpty();
RuleFor(model => model.Purpose)
.NotEmpty();
RuleFor(model => model.Code)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<VerifyOtpTokenRequest>.CreateWithOptions((VerifyOtpTokenRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}
@@ -8,8 +8,6 @@ public class UpdateUserRequestValidator : AbstractValidator<UpdateUserRequest>
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Mobile)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{