All checks were successful
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 5m28s
256 lines
7.1 KiB
Protocol Buffer
256 lines
7.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package networkmembership;
|
|
|
|
import "public_messages.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/wrappers.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/api/annotations.proto";
|
|
|
|
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.NetworkMembership";
|
|
|
|
service NetworkMembershipContract
|
|
{
|
|
rpc JoinNetwork(JoinNetworkRequest) returns (google.protobuf.Empty){
|
|
option (google.api.http) = {
|
|
post: "/NetworkMembership/Join"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc ChangeNetworkParent(ChangeNetworkParentRequest) returns (google.protobuf.Empty){
|
|
option (google.api.http) = {
|
|
post: "/NetworkMembership/ChangeParent"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc RemoveFromNetwork(RemoveFromNetworkRequest) returns (google.protobuf.Empty){
|
|
option (google.api.http) = {
|
|
post: "/NetworkMembership/Remove"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc GetUserNetwork(GetUserNetworkRequest) returns (GetUserNetworkResponse){
|
|
option (google.api.http) = {
|
|
get: "/NetworkMembership/GetUserNetwork"
|
|
};
|
|
};
|
|
rpc GetNetworkTree(GetNetworkTreeRequest) returns (GetNetworkTreeResponse){
|
|
option (google.api.http) = {
|
|
get: "/NetworkMembership/GetNetworkTree"
|
|
};
|
|
};
|
|
rpc GetNetworkMembershipHistory(GetNetworkMembershipHistoryRequest) returns (GetNetworkMembershipHistoryResponse){
|
|
option (google.api.http) = {
|
|
get: "/NetworkMembership/GetHistory"
|
|
};
|
|
};
|
|
rpc GetNetworkStatistics(GetNetworkStatisticsRequest) returns (GetNetworkStatisticsResponse){
|
|
option (google.api.http) = {
|
|
get: "/NetworkMembership/GetStatistics"
|
|
};
|
|
};
|
|
}
|
|
|
|
// JoinNetwork Command
|
|
message JoinNetworkRequest
|
|
{
|
|
int64 user_id = 1;
|
|
int64 parent_id = 2;
|
|
int32 leg = 3; // NetworkLeg enum: Left=0, Right=1
|
|
google.protobuf.StringValue referral_code = 4;
|
|
}
|
|
|
|
// ChangeParent Command
|
|
message ChangeNetworkParentRequest
|
|
{
|
|
int64 user_id = 1;
|
|
int64 new_parent_id = 2;
|
|
int32 new_leg = 3; // NetworkLeg enum
|
|
string reason = 4;
|
|
}
|
|
|
|
// Remove Command
|
|
message RemoveFromNetworkRequest
|
|
{
|
|
int64 user_id = 1;
|
|
string reason = 2;
|
|
}
|
|
|
|
// GetUserNetwork Query
|
|
message GetUserNetworkRequest
|
|
{
|
|
int64 user_id = 1;
|
|
}
|
|
|
|
message GetUserNetworkResponse
|
|
{
|
|
// اطلاعات اصلی کاربر
|
|
int64 id = 1;
|
|
int64 user_id = 2;
|
|
string user_name = 3;
|
|
string mobile = 4;
|
|
string email = 5;
|
|
string national_code = 6;
|
|
string referral_code = 7;
|
|
bool is_mobile_verified = 8;
|
|
google.protobuf.Timestamp birth_date = 9;
|
|
google.protobuf.Timestamp joined_at = 10;
|
|
|
|
// اطلاعات والد
|
|
google.protobuf.Int64Value parent_id = 11;
|
|
string parent_name = 12;
|
|
string parent_mobile = 13;
|
|
|
|
// موقعیت در شبکه
|
|
int32 network_leg = 14; // NetworkLeg enum
|
|
int32 network_level = 15;
|
|
bool is_in_network = 16;
|
|
|
|
// اطلاعات فرزند چپ
|
|
google.protobuf.Int64Value left_child_id = 17;
|
|
string left_child_name = 18;
|
|
string left_child_mobile = 19;
|
|
google.protobuf.Timestamp left_child_joined_at = 20;
|
|
|
|
// اطلاعات فرزند راست
|
|
google.protobuf.Int64Value right_child_id = 21;
|
|
string right_child_name = 22;
|
|
string right_child_mobile = 23;
|
|
google.protobuf.Timestamp right_child_joined_at = 24;
|
|
|
|
// آمار فرزندان مستقیم
|
|
int32 total_children = 25;
|
|
int32 left_child_count = 26;
|
|
int32 right_child_count = 27;
|
|
|
|
// آمار کل شبکه
|
|
int32 total_left_leg_members = 28;
|
|
int32 total_right_leg_members = 29;
|
|
int32 total_network_size = 30;
|
|
int32 max_network_depth = 31;
|
|
|
|
// اطلاعات پکیج و دایا
|
|
bool has_received_daya_credit = 32;
|
|
google.protobuf.Timestamp daya_credit_received_at = 33;
|
|
int32 package_purchase_method = 34;
|
|
bool has_purchased_golden_package = 35;
|
|
|
|
// آمار مالی
|
|
double total_earned_commission = 36;
|
|
double total_paid_commission = 37;
|
|
double pending_commission = 38;
|
|
int32 total_balances_earned = 39;
|
|
|
|
// آمار فعالیت
|
|
int32 active_members_in_network = 40;
|
|
int32 inactive_members_in_network = 41;
|
|
|
|
google.protobuf.Timestamp created = 42;
|
|
}
|
|
|
|
// GetNetworkTree Query
|
|
message GetNetworkTreeRequest
|
|
{
|
|
int64 user_id = 1;
|
|
google.protobuf.Int32Value max_depth = 2;
|
|
google.protobuf.BoolValue only_active = 3;
|
|
google.protobuf.BoolValue is_club_active = 4;
|
|
google.protobuf.StringValue activation_week_number = 5;
|
|
}
|
|
|
|
message GetNetworkTreeResponse
|
|
{
|
|
repeated NetworkTreeNodeModel nodes = 1;
|
|
}
|
|
|
|
message NetworkTreeNodeModel
|
|
{
|
|
int64 user_id = 1;
|
|
string user_name = 2;
|
|
google.protobuf.Int64Value parent_id = 3;
|
|
int32 network_leg = 4;
|
|
int32 network_level = 5;
|
|
bool is_active = 6;
|
|
google.protobuf.Timestamp joined_at = 7;
|
|
google.protobuf.Timestamp club_activated_at = 8; // تاریخ فعالسازی در باشگاه
|
|
bool is_club_active = 9; // فعال بودن در باشگاه
|
|
string activation_week_number = 10; // شماره هفته فعالسازی
|
|
bool is_activated_in_target_week = 11; // آیا در هفته هدف فعال شده
|
|
google.protobuf.Timestamp user_created = 12; // تاریخ ایجاد کاربر
|
|
}
|
|
|
|
// GetHistory Query
|
|
message GetNetworkMembershipHistoryRequest
|
|
{
|
|
google.protobuf.Int64Value user_id = 1;
|
|
google.protobuf.Int64Value parent_id = 2;
|
|
int32 page_index = 3;
|
|
int32 page_size = 4;
|
|
}
|
|
|
|
message GetNetworkMembershipHistoryResponse
|
|
{
|
|
messages.MetaData meta_data = 1;
|
|
repeated NetworkMembershipHistoryModel models = 2;
|
|
}
|
|
|
|
message NetworkMembershipHistoryModel
|
|
{
|
|
int64 id = 1;
|
|
int64 user_id = 2;
|
|
google.protobuf.Int64Value old_parent_id = 3;
|
|
google.protobuf.Int64Value new_parent_id = 4;
|
|
google.protobuf.Int32Value old_network_leg = 5;
|
|
google.protobuf.Int32Value new_network_leg = 6;
|
|
google.protobuf.Int32Value old_network_level = 7;
|
|
google.protobuf.Int32Value new_network_level = 8;
|
|
int32 action = 9; // NetworkMembershipAction enum
|
|
string performed_by = 10;
|
|
string reason = 11;
|
|
google.protobuf.Timestamp created = 12;
|
|
}
|
|
|
|
// GetNetworkStatistics Query
|
|
message GetNetworkStatisticsRequest
|
|
{
|
|
// Empty - returns overall network statistics
|
|
}
|
|
|
|
message GetNetworkStatisticsResponse
|
|
{
|
|
int32 total_members = 1;
|
|
int32 active_members = 2;
|
|
int32 left_leg_count = 3;
|
|
int32 right_leg_count = 4;
|
|
double left_percentage = 5;
|
|
double right_percentage = 6;
|
|
double average_depth = 7;
|
|
int32 max_depth = 8;
|
|
repeated LevelDistribution level_distribution = 9;
|
|
repeated MonthlyGrowth monthly_growth = 10;
|
|
repeated TopNetworkUser top_users = 11;
|
|
}
|
|
|
|
message LevelDistribution
|
|
{
|
|
int32 level = 1;
|
|
int32 count = 2;
|
|
}
|
|
|
|
message MonthlyGrowth
|
|
{
|
|
string month = 1; // Format: "2025-11" or Persian month name
|
|
int32 new_members = 2;
|
|
}
|
|
|
|
message TopNetworkUser
|
|
{
|
|
int32 rank = 1;
|
|
int64 user_id = 2;
|
|
string user_name = 3;
|
|
int32 total_children = 4;
|
|
int32 left_count = 5;
|
|
int32 right_count = 6;
|
|
}
|