Merge branch 'newmain'
This commit is contained in:
@@ -48,6 +48,18 @@ service UserContract
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc AdminGetJwtToken(AdminGetJwtTokenRequest) returns (AdminGetJwtTokenResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/AdminGetJwtToken"
|
||||
|
||||
};
|
||||
};
|
||||
rpc SetPasswordForUser(SetPasswordForUserRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
post: "/SetPasswordForUser"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
}
|
||||
message UpdateUserRequest
|
||||
{
|
||||
@@ -161,31 +173,47 @@ message VerifyOtpTokenResponse
|
||||
int32 remaining_attempts = 4;
|
||||
int32 remaining_seconds = 5;
|
||||
}
|
||||
|
||||
message PaginationState
|
||||
message AdminGetJwtTokenRequest
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
}
|
||||
message MetaData
|
||||
message AdminGetJwtTokenResponse
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
string token = 1;
|
||||
}
|
||||
message DecimalValue
|
||||
message SetPasswordForUserRequest
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
google.protobuf.StringValue current_password = 1;
|
||||
string new_password = 2;
|
||||
string confirm_password = 3;
|
||||
}
|
||||
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using FrontOfficeMicroservice.Protobuf.Protos.User;
|
||||
namespace FrontOfficeMicroservice.Protobuf.Validator.User;
|
||||
|
||||
public class AdminGetJwtTokenRequestValidator : AbstractValidator<AdminGetJwtTokenRequest>
|
||||
{
|
||||
public AdminGetJwtTokenRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Username)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Password)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<AdminGetJwtTokenRequest>.CreateWithOptions((AdminGetJwtTokenRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using FrontOfficeMicroservice.Protobuf.Protos.User;
|
||||
namespace FrontOfficeMicroservice.Protobuf.Validator.User;
|
||||
|
||||
public class SetPasswordForUserRequestValidator : AbstractValidator<SetPasswordForUserRequest>
|
||||
{
|
||||
public SetPasswordForUserRequestValidator()
|
||||
{
|
||||
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);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user