Generator Changes at 11/12/2025 11:18:31 PM +03:30

This commit is contained in:
masoodafar-web
2025-11-12 23:20:15 +03:30
parent 0adb0713f3
commit 4b1b135065
8 changed files with 121 additions and 0 deletions

View File

@@ -55,6 +55,12 @@ service UserContract
};
};
rpc SetPasswordForUser(SetPasswordForUserRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
post: "/SetPasswordForUser"
body: "*"
};
};
}
message CreateNewUserRequest
{
@@ -174,3 +180,10 @@ message AdminGetJwtTokenResponse
{
string token = 1;
}
message SetPasswordForUserRequest
{
int64 user_id = 1;
google.protobuf.StringValue current_password = 2;
string new_password = 3;
string confirm_password = 4;
}

View File

@@ -0,0 +1,23 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.User;
namespace CMSMicroservice.Protobuf.Validator.User;
public class SetPasswordForUserRequestValidator : AbstractValidator<SetPasswordForUserRequest>
{
public SetPasswordForUserRequestValidator()
{
RuleFor(model => model.UserId)
.NotNull();
RuleFor(model => model.NewPassword)
.NotEmpty();
RuleFor(model => model.ConfirmPassword)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<SetPasswordForUserRequest>.CreateWithOptions((SetPasswordForUserRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}