Generator Changes at 9/27/2025 11:07:17 PM

This commit is contained in:
MeysamMoghaddam
2025-09-27 23:48:41 +03:30
parent 447e580a8a
commit a1b6e28d35
45 changed files with 1320 additions and 18 deletions

View File

@@ -4,7 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.111</Version>
<Version>0.0.112</Version>
<DebugType>None</DebugType>
<DebugSymbols>False</DebugSymbols>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
@@ -29,6 +29,7 @@
<Protobuf Include="Protos\userorder.proto" ProtoRoot="Protos\" GrpcServices="Both" />
<Protobuf Include="Protos\role.proto" ProtoRoot="Protos\" GrpcServices="Both" />
<Protobuf Include="Protos\userrole.proto" ProtoRoot="Protos\" GrpcServices="Both" />
<Protobuf Include="Protos\otptoken.proto" ProtoRoot="Protos\" GrpcServices="Both" />
<Protobuf Include="Protos\public_messages.proto" ProtoRoot="Protos\" GrpcServices="Both" />
</ItemGroup>

View File

@@ -0,0 +1,87 @@
syntax = "proto3";
package otptoken;
import "public_messages.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.OtpToken";
service OtpTokenContract
{
rpc CreateNewOtpToken(CreateNewOtpTokenRequest) returns (CreateNewOtpTokenResponse){
option (google.api.http) = {
post: "/CreateNewOtpToken"
body: "*"
};
};
rpc VerifyOtpToken(VerifyOtpTokenRequest) returns (VerifyOtpTokenResponse){
option (google.api.http) = {
post: "/VerifyOtpToken"
body: "*"
};
};
rpc GetAllOtpTokenByFilter(GetAllOtpTokenByFilterRequest) returns (GetAllOtpTokenByFilterResponse){
option (google.api.http) = {
get: "/GetAllOtpTokenByFilter"
};
};
}
message CreateNewOtpTokenRequest
{
string mobile = 1;
string purpose = 2;
}
message CreateNewOtpTokenResponse
{
bool success = 1;
string message = 2;
google.protobuf.StringValue code = 3;
}
message VerifyOtpTokenRequest
{
string mobile = 1;
string purpose = 2;
string code = 3;
}
message VerifyOtpTokenResponse
{
bool success = 1;
string message = 2;
}
message GetAllOtpTokenByFilterRequest
{
messages.PaginationState pagination_state = 1;
google.protobuf.StringValue sort_by = 2;
GetAllOtpTokenByFilterFilter filter = 3;
}
message GetAllOtpTokenByFilterFilter
{
google.protobuf.Int64Value id = 1;
google.protobuf.StringValue mobile = 2;
google.protobuf.StringValue purpose = 3;
google.protobuf.StringValue code_hash = 4;
google.protobuf.Timestamp expires_at = 5;
google.protobuf.Int32Value attempts = 6;
google.protobuf.BoolValue is_used = 7;
}
message GetAllOtpTokenByFilterResponse
{
messages.MetaData meta_data = 1;
repeated GetAllOtpTokenByFilterResponseModel models = 2;
}
message GetAllOtpTokenByFilterResponseModel
{
int64 id = 1;
string mobile = 2;
string purpose = 3;
string code_hash = 4;
google.protobuf.Timestamp expires_at = 5;
int32 attempts = 6;
bool is_used = 7;
}

View File

@@ -62,10 +62,8 @@ message UpdateUserRequest
int64 id = 1;
google.protobuf.StringValue first_name = 2;
google.protobuf.StringValue last_name = 3;
string mobile = 4;
google.protobuf.StringValue national_code = 5;
google.protobuf.StringValue avatar_path = 6;
google.protobuf.Int64Value parent_id = 7;
google.protobuf.StringValue national_code = 4;
google.protobuf.StringValue avatar_path = 5;
}
message DeleteUserRequest
{
@@ -84,6 +82,9 @@ message GetUserResponse
google.protobuf.StringValue national_code = 5;
google.protobuf.StringValue avatar_path = 6;
google.protobuf.Int64Value parent_id = 7;
string referral_code = 8;
bool is_mobile_verified = 9;
google.protobuf.Timestamp mobile_verified_at = 10;
}
message GetAllUserByFilterRequest
{
@@ -100,6 +101,9 @@ message GetAllUserByFilterFilter
google.protobuf.StringValue national_code = 5;
google.protobuf.StringValue avatar_path = 6;
google.protobuf.Int64Value parent_id = 7;
google.protobuf.StringValue referral_code = 8;
google.protobuf.BoolValue is_mobile_verified = 9;
google.protobuf.Timestamp mobile_verified_at = 10;
}
message GetAllUserByFilterResponse
{
@@ -115,4 +119,7 @@ message GetAllUserByFilterResponseModel
google.protobuf.StringValue national_code = 5;
google.protobuf.StringValue avatar_path = 6;
google.protobuf.Int64Value parent_id = 7;
string referral_code = 8;
bool is_mobile_verified = 9;
google.protobuf.Timestamp mobile_verified_at = 10;
}

View File

@@ -0,0 +1,21 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace CMSMicroservice.Protobuf.Validator.OtpToken;
public class CreateNewOtpTokenRequestValidator : AbstractValidator<CreateNewOtpTokenRequest>
{
public CreateNewOtpTokenRequestValidator()
{
RuleFor(model => model.Mobile)
.NotEmpty();
RuleFor(model => model.Purpose)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<CreateNewOtpTokenRequest>.CreateWithOptions((CreateNewOtpTokenRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,17 @@
using FluentValidation;
using CMSMicroservice.Protobuf.Protos.OtpToken;
namespace CMSMicroservice.Protobuf.Validator.OtpToken;
public class GetAllOtpTokenByFilterRequestValidator : AbstractValidator<GetAllOtpTokenByFilterRequest>
{
public GetAllOtpTokenByFilterRequestValidator()
{
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetAllOtpTokenByFilterRequest>.CreateWithOptions((GetAllOtpTokenByFilterRequest)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

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

View File

@@ -8,8 +8,6 @@ public class UpdateUserRequestValidator : AbstractValidator<UpdateUserRequest>
{
RuleFor(model => model.Id)
.NotNull();
RuleFor(model => model.Mobile)
.NotEmpty();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{