Generator Changes at 11/22/2025 9:58:16 PM +03:30

This commit is contained in:
masoodafar-web
2025-11-22 22:02:04 +03:30
parent fb9d2f6a9c
commit 56478c79c2
22 changed files with 281 additions and 31 deletions

View File

@@ -49,3 +49,8 @@ enum ContractType
Main = 0;
CMS = 1;
}
enum PaymentMethod
{
IPG = 0;
Wallet = 1;
}

View File

@@ -43,16 +43,29 @@ service UserOrderContract
};
};
rpc SubmitShopBuyOrder(SubmitShopBuyOrderRequest) returns (SubmitShopBuyOrderResponse){
option (google.api.http) = {
post: "/SubmitShopBuyOrder"
body: "*"
};
};
}
message CreateNewUserOrderRequest
{
int64 price = 1;
int64 package_id = 2;
google.protobuf.Int64Value transaction_id = 3;
bool payment_status = 4;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 4;
}
google.protobuf.Timestamp payment_date = 5;
int64 user_id = 6;
int64 user_address_id = 7;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 8;
}
}
message CreateNewUserOrderResponse
{
@@ -64,10 +77,17 @@ message UpdateUserOrderRequest
int64 price = 2;
int64 package_id = 3;
google.protobuf.Int64Value transaction_id = 4;
bool payment_status = 5;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 5;
}
google.protobuf.Timestamp payment_date = 6;
int64 user_id = 7;
int64 user_address_id = 8;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 9;
}
}
message DeleteUserOrderRequest
{
@@ -83,10 +103,19 @@ message GetUserOrderResponse
int64 price = 2;
int64 package_id = 3;
google.protobuf.Int64Value transaction_id = 4;
bool payment_status = 5;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 5;
}
google.protobuf.Timestamp payment_date = 6;
int64 user_id = 7;
int64 user_address_id = 8;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 9;
}
google.protobuf.Int64Value total_amount = 10;
google.protobuf.StringValue user_address_text = 11;
}
message GetAllUserOrderByFilterRequest
{
@@ -100,10 +129,17 @@ message GetAllUserOrderByFilterFilter
google.protobuf.Int64Value price = 2;
google.protobuf.Int64Value package_id = 3;
google.protobuf.Int64Value transaction_id = 4;
google.protobuf.Int32Value payment_status = 5;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 5;
}
google.protobuf.Timestamp payment_date = 6;
google.protobuf.Int64Value user_id = 7;
google.protobuf.Int64Value user_address_id = 8;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 9;
}
}
message GetAllUserOrderByFilterResponse
{
@@ -116,8 +152,47 @@ message GetAllUserOrderByFilterResponseModel
int64 price = 2;
int64 package_id = 3;
google.protobuf.Int64Value transaction_id = 4;
int32 payment_status = 5;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 5;
}
google.protobuf.Timestamp payment_date = 6;
int64 user_id = 7;
int64 user_address_id = 8;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 9;
}
google.protobuf.StringValue user_address_text = 10;
google.protobuf.Int64Value total_amount = 11;
}
message SubmitShopBuyOrderRequest
{
int64 total_amount = 1;
int64 user_id = 2;
}
message SubmitShopBuyOrderResponse
{
int64 id = 1;
oneof PaymentStatus_item
{
messages.PaymentStatus payment_status = 2;
}
google.protobuf.Timestamp created = 3;
oneof PaymentMethod_item
{
messages.PaymentMethod payment_method = 4;
}
google.protobuf.StringValue user_address_text = 5;
google.protobuf.Int64Value total_amount = 6;
repeated SubmitShopBuyOrderFactorDetail factor_details = 7;
}
message SubmitShopBuyOrderFactorDetail
{
int64 product_id = 1;
string product_title = 2;
google.protobuf.StringValue product_thumbnail_path = 3;
google.protobuf.Int64Value unit_price = 4;
google.protobuf.Int32Value count = 5;
google.protobuf.Int64Value unit_discount_price = 6;
}

View File

@@ -11,11 +11,14 @@ public class CreateNewUserOrderRequestValidator : AbstractValidator<CreateNewUse
RuleFor(model => model.PackageId)
.NotNull();
RuleFor(model => model.PaymentStatus)
.IsInEnum()
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
RuleFor(model => model.UserAddressId)
.NotNull();
RuleFor(model => model.PaymentMethod)
.IsInEnum();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{

View File

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

View File

@@ -13,11 +13,14 @@ public class UpdateUserOrderRequestValidator : AbstractValidator<UpdateUserOrder
RuleFor(model => model.PackageId)
.NotNull();
RuleFor(model => model.PaymentStatus)
.IsInEnum()
.NotNull();
RuleFor(model => model.UserId)
.NotNull();
RuleFor(model => model.UserAddressId)
.NotNull();
RuleFor(model => model.PaymentMethod)
.IsInEnum();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{