Generator Changes at 10/13/2025 8:08:52 AM

This commit is contained in:
MeysamMoghaddam
2025-10-13 08:19:47 +03:30
parent afad9b62be
commit f7da86ec02
41 changed files with 869 additions and 5 deletions
@@ -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) =>
{
@@ -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) =>
{