Generator Changes at 10/13/2025 8:08:52 AM
This commit is contained in:
@@ -8,6 +8,12 @@ public class CreateNewUserRequestValidator : AbstractValidator<CreateNewUserRequ
|
||||
{
|
||||
RuleFor(model => model.Mobile)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.EmailNotifications)
|
||||
.NotNull();
|
||||
RuleFor(model => model.SmsNotifications)
|
||||
.NotNull();
|
||||
RuleFor(model => model.PushNotifications)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
|
||||
@@ -10,6 +10,12 @@ public class UpdateUserRequestValidator : AbstractValidator<UpdateUserRequest>
|
||||
.NotNull();
|
||||
RuleFor(model => model.IsRulesAccepted)
|
||||
.NotNull();
|
||||
RuleFor(model => model.EmailNotifications)
|
||||
.NotNull();
|
||||
RuleFor(model => model.SmsNotifications)
|
||||
.NotNull();
|
||||
RuleFor(model => model.PushNotifications)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserAddress;
|
||||
|
||||
public class SetAddressAsDefaultRequestValidator : AbstractValidator<SetAddressAsDefaultRequest>
|
||||
{
|
||||
public SetAddressAsDefaultRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<SetAddressAsDefaultRequest>.CreateWithOptions((SetAddressAsDefaultRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -14,6 +14,8 @@ public class CreateNewUserOrderRequestValidator : AbstractValidator<CreateNewUse
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserAddressId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@ public class UpdateUserOrderRequestValidator : AbstractValidator<UpdateUserOrder
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserAddressId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user