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)
This commit is contained in:
masoodafar-web
2025-11-29 04:45:27 +03:30
parent 3010881b4e
commit 2bb8c2a13c
9 changed files with 890 additions and 0 deletions
@@ -0,0 +1,133 @@
syntax = "proto3";
package configuration;
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.Configuration";
service ConfigurationContract
{
rpc CreateOrUpdateConfiguration(CreateOrUpdateConfigurationRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
post: "/Configuration/CreateOrUpdate"
body: "*"
};
};
rpc DeactivateConfiguration(DeactivateConfigurationRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
post: "/Configuration/Deactivate"
body: "*"
};
};
rpc GetConfigurationByKey(GetConfigurationByKeyRequest) returns (GetConfigurationByKeyResponse){
option (google.api.http) = {
get: "/Configuration/GetByKey"
};
};
rpc GetAllConfigurations(GetAllConfigurationsRequest) returns (GetAllConfigurationsResponse){
option (google.api.http) = {
get: "/Configuration/GetAll"
};
};
rpc GetConfigurationHistory(GetConfigurationHistoryRequest) returns (GetConfigurationHistoryResponse){
option (google.api.http) = {
get: "/Configuration/GetHistory"
};
};
}
// CreateOrUpdate Command
message CreateOrUpdateConfigurationRequest
{
string key = 1;
string value = 2;
google.protobuf.StringValue description = 3;
int32 scope = 4; // ConfigurationScope enum: System=0, Network=1, Club=2, Commission=3
}
// Deactivate Command
message DeactivateConfigurationRequest
{
string key = 1;
google.protobuf.StringValue reason = 2;
}
// GetByKey Query
message GetConfigurationByKeyRequest
{
string key = 1;
}
message GetConfigurationByKeyResponse
{
int64 id = 1;
string key = 2;
string value = 3;
string description = 4;
int32 scope = 5;
bool is_active = 6;
google.protobuf.Timestamp created = 7;
google.protobuf.Timestamp last_modified = 8;
}
// GetAll Query
message GetAllConfigurationsRequest
{
google.protobuf.Int32Value scope = 1;
google.protobuf.BoolValue is_active = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetAllConfigurationsResponse
{
messages.MetaData meta_data = 1;
repeated ConfigurationModel models = 2;
}
message ConfigurationModel
{
int64 id = 1;
string key = 2;
string value = 3;
string description = 4;
int32 scope = 5;
bool is_active = 6;
google.protobuf.Timestamp created = 7;
}
// GetHistory Query
message GetConfigurationHistoryRequest
{
google.protobuf.Int64Value configuration_id = 1;
google.protobuf.StringValue key = 2;
int32 page_index = 3;
int32 page_size = 4;
}
message GetConfigurationHistoryResponse
{
messages.MetaData meta_data = 1;
repeated ConfigurationHistoryModel models = 2;
}
message ConfigurationHistoryModel
{
int64 id = 1;
int64 configuration_id = 2;
string key = 3;
string old_value = 4;
string new_value = 5;
string old_description = 6;
string new_description = 7;
int32 old_scope = 8;
int32 new_scope = 9;
string performed_by = 10;
string reason = 11;
google.protobuf.Timestamp created = 12;
}