feat: Add gRPC API Layer - Phase 6 Integration
Added Protobuf definitions and gRPC services for all CQ layers:
Protobuf Files (4):
- configuration.proto: 2 Commands + 3 Queries (5 RPCs)
- clubmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- networkmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- commission.proto: 5 Commands + 4 Queries (9 RPCs)
gRPC Services (4):
- ConfigurationService: SetConfigurationValue, Deactivate, GetByKey, GetAll, GetHistory
- ClubMembershipService: Activate, Deactivate, AssignFeature, Get, GetAll, GetHistory
- NetworkMembershipService: Join, Move, Remove, GetPosition, GetTree, GetHistory
- CommissionService: Calculate+Process+Withdraw (5 commands), Get queries (4)
Features:
- HTTP transcoding enabled via google.api.http annotations
- Auto-registration via ConfigureGrpcEndpoints
- MetaData pagination support
- Request/Response DTOs for all endpoints
- Integration with MediatR CQRS handlers
Total: 4 proto files, 4 service classes, 26 RPC endpoints
Build: ✅ Successful (0 errors)
2025-11-29 04:45:27 +03:30
|
|
|
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"
|
|
|
|
|
};
|
|
|
|
|
};
|
2025-12-01 16:43:53 +03:30
|
|
|
rpc GetNetworkStatistics(GetNetworkStatisticsRequest) returns (GetNetworkStatisticsResponse){
|
|
|
|
|
option (google.api.http) = {
|
|
|
|
|
get: "/NetworkMembership/GetStatistics"
|
|
|
|
|
};
|
|
|
|
|
};
|
feat: Add gRPC API Layer - Phase 6 Integration
Added Protobuf definitions and gRPC services for all CQ layers:
Protobuf Files (4):
- configuration.proto: 2 Commands + 3 Queries (5 RPCs)
- clubmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- networkmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- commission.proto: 5 Commands + 4 Queries (9 RPCs)
gRPC Services (4):
- ConfigurationService: SetConfigurationValue, Deactivate, GetByKey, GetAll, GetHistory
- ClubMembershipService: Activate, Deactivate, AssignFeature, Get, GetAll, GetHistory
- NetworkMembershipService: Join, Move, Remove, GetPosition, GetTree, GetHistory
- CommissionService: Calculate+Process+Withdraw (5 commands), Get queries (4)
Features:
- HTTP transcoding enabled via google.api.http annotations
- Auto-registration via ConfigureGrpcEndpoints
- MetaData pagination support
- Request/Response DTOs for all endpoints
- Integration with MediatR CQRS handlers
Total: 4 proto files, 4 service classes, 26 RPC endpoints
Build: ✅ Successful (0 errors)
2025-11-29 04:45:27 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
google.protobuf.Int64Value parent_id = 4;
|
|
|
|
|
string parent_name = 5;
|
|
|
|
|
int32 network_leg = 6; // NetworkLeg enum
|
|
|
|
|
google.protobuf.Int64Value left_child_id = 7;
|
|
|
|
|
string left_child_name = 8;
|
|
|
|
|
google.protobuf.Int64Value right_child_id = 9;
|
|
|
|
|
string right_child_name = 10;
|
|
|
|
|
int32 network_level = 11;
|
|
|
|
|
string referral_code = 12;
|
|
|
|
|
google.protobuf.Timestamp joined_at = 13;
|
|
|
|
|
google.protobuf.Timestamp created = 14;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetNetworkTree Query
|
|
|
|
|
message GetNetworkTreeRequest
|
|
|
|
|
{
|
2025-12-08 04:10:46 +03:30
|
|
|
int64 user_id = 1;
|
feat: Add gRPC API Layer - Phase 6 Integration
Added Protobuf definitions and gRPC services for all CQ layers:
Protobuf Files (4):
- configuration.proto: 2 Commands + 3 Queries (5 RPCs)
- clubmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- networkmembership.proto: 3 Commands + 3 Queries (6 RPCs)
- commission.proto: 5 Commands + 4 Queries (9 RPCs)
gRPC Services (4):
- ConfigurationService: SetConfigurationValue, Deactivate, GetByKey, GetAll, GetHistory
- ClubMembershipService: Activate, Deactivate, AssignFeature, Get, GetAll, GetHistory
- NetworkMembershipService: Join, Move, Remove, GetPosition, GetTree, GetHistory
- CommissionService: Calculate+Process+Withdraw (5 commands), Get queries (4)
Features:
- HTTP transcoding enabled via google.api.http annotations
- Auto-registration via ConfigureGrpcEndpoints
- MetaData pagination support
- Request/Response DTOs for all endpoints
- Integration with MediatR CQRS handlers
Total: 4 proto files, 4 service classes, 26 RPC endpoints
Build: ✅ Successful (0 errors)
2025-11-29 04:45:27 +03:30
|
|
|
google.protobuf.Int32Value max_depth = 2;
|
|
|
|
|
google.protobuf.BoolValue only_active = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
2025-12-01 16:43:53 +03:30
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
}
|