Generator Changes at 11/12/2025 1:32:03 AM +03:30
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class CreateNewUserWalletRequestValidator : AbstractValidator<CreateNewUserWalletRequest>
|
||||
{
|
||||
public CreateNewUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Balance)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserWalletRequest>.CreateWithOptions((CreateNewUserWalletRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class DeleteUserWalletRequestValidator : AbstractValidator<DeleteUserWalletRequest>
|
||||
{
|
||||
public DeleteUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteUserWalletRequest>.CreateWithOptions((DeleteUserWalletRequest)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.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class GetAllUserWalletByFilterRequestValidator : AbstractValidator<GetAllUserWalletByFilterRequest>
|
||||
{
|
||||
public GetAllUserWalletByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllUserWalletByFilterRequest>.CreateWithOptions((GetAllUserWalletByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class GetUserWalletRequestValidator : AbstractValidator<GetUserWalletRequest>
|
||||
{
|
||||
public GetUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetUserWalletRequest>.CreateWithOptions((GetUserWalletRequest)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.UserWallet;
|
||||
namespace CMSMicroservice.Protobuf.Validator.UserWallet;
|
||||
|
||||
public class UpdateUserWalletRequestValidator : AbstractValidator<UpdateUserWalletRequest>
|
||||
{
|
||||
public UpdateUserWalletRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Balance)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateUserWalletRequest>.CreateWithOptions((UpdateUserWalletRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user