feat: update Protobuf definitions and add customer-facing APIs for various services

This commit is contained in:
masoodafar-web
2026-02-01 22:16:36 +03:30
parent 658d076bdf
commit 794dd01ac0
13 changed files with 329 additions and 11 deletions
@@ -50,6 +50,25 @@ service NetworkMembershipContract
get: "/NetworkMembership/GetStatistics"
};
};
// Customer-facing APIs
rpc GetMyNetworkTree(GetMyNetworkTreeRequest) returns (GetMyNetworkTreeResponse){
option (google.api.http) = {
get: "/NetworkMembership/Customer/MyTree"
};
};
rpc GetSubordinateTree(GetSubordinateTreeRequest) returns (GetMyNetworkTreeResponse){
option (google.api.http) = {
get: "/NetworkMembership/Customer/SubordinateTree/{target_user_id}"
};
};
rpc GetMyNetworkStatistics(google.protobuf.Empty) returns (GetMyNetworkStatisticsResponse){
option (google.api.http) = {
get: "/NetworkMembership/Customer/MyStats"
};
};
}
// JoinNetwork Command
@@ -168,9 +187,11 @@ message NetworkTreeNodeModel
{
int64 user_id = 1;
string user_name = 2;
string full_name = 20; // Alias for frontend compatibility
google.protobuf.Int64Value parent_id = 3;
int32 network_leg = 4;
int32 network_level = 5;
int32 level = 21; // Alias for frontend compatibility
bool is_active = 6;
google.protobuf.Timestamp joined_at = 7;
google.protobuf.Timestamp club_activated_at = 8; // تاریخ فعال‌سازی در باشگاه
@@ -179,6 +200,11 @@ message NetworkTreeNodeModel
bool is_activated_in_target_week = 11; // آیا در هفته هدف فعال شده
google.protobuf.Timestamp user_created = 12; // تاریخ ایجاد کاربر
string referral_code = 13; // کد معرف کاربر
string mobile = 14; // Mobile number for display
google.protobuf.StringValue avatar = 15; // Avatar path
string position = 16; // Root/Left/Right position indicator
NetworkTreeNodeModel left_child = 17; // Left child node
NetworkTreeNodeModel right_child = 18; // Right child node
}
// GetHistory Query
@@ -254,3 +280,51 @@ message TopNetworkUser
int32 left_count = 5;
int32 right_count = 6;
}
// ============ Customer APIs ============
// GetMyNetworkTree - for frontend customer display
message GetMyNetworkTreeRequest
{
int32 max_depth = 1; // Default: 3
}
// GetSubordinateTree - for frontend customer display
message GetSubordinateTreeRequest
{
int64 target_user_id = 1;
int32 max_depth = 2; // Default: 3
}
message GetMyNetworkTreeResponse
{
NetworkTreeNodeModel root_node = 1;
int32 total_members = 2;
int32 current_depth = 3;
}
// GetMyNetworkStatistics - for frontend customer display
message GetMyNetworkStatisticsResponse
{
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;
string weaker_leg = 9;
int32 my_network_level = 10;
string my_network_leg = 11;
string my_referral_code = 12;
CustomerLastMemberModel last_member = 13;
}
message CustomerLastMemberModel
{
int64 user_id = 1;
string full_name = 2;
string position = 3;
int32 total_children = 4;
}