Generator Changes at 9/27/2025 11:07:17 PM
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
+17
@@ -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) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user