Complete FrontOffice BFF to CMS Migration

- Migrated all 9 services from FrontOffice.BFF to CMS architecture
- Enhanced user.proto with 7 additional Customer API endpoints:
  * UpdateCustomerProfile, GetCustomerProfile
  * ChangeCustomerPassword with validation
  * GetCustomerReferrals with commission stats
  * UploadCustomerAvatar with file validation
  * GetCustomerSettings, UpdateCustomerSettings
- All services now support Customer endpoints with /Customer/ prefix
- Mock implementations with realistic Persian data
- Fixed namespace conflicts and compilation issues
- Comprehensive testing completed for all endpoints
- Services migrated: Categories, City, UserCarts, Products, UserWallet,
  Transaction, UserOrder, Package, User (enhanced)
This commit is contained in:
masoodafar-web
2026-01-30 08:53:09 +03:30
parent 96daf899c7
commit 658d076bdf
170 changed files with 3770 additions and 4364 deletions
+259 -3
View File
@@ -2,7 +2,7 @@ syntax = "proto3";
package user;
import "public_messages.proto";
import "City.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/duration.proto";
@@ -67,6 +67,72 @@ service UserContract
body: "*"
};
};
rpc CreateNewOtpToken(CreateNewOtpTokenRequest) returns (CreateNewOtpTokenResponse){
option (google.api.http) = {
post: "/Customer/CreateNewOtpToken"
body: "*"
};
};
rpc VerifyOtpToken(VerifyOtpTokenRequest) returns (VerifyOtpTokenResponse){
option (google.api.http) = {
post: "/Customer/VerifyOtpToken"
body: "*"
};
};
rpc AcceptContract(AcceptContractRequest) returns (AcceptContractResponse){
option (google.api.http) = {
post: "/Customer/AcceptContract"
body: "*"
};
};
rpc GetUserForCustomer(GetUserForCustomerRequest) returns (GetUserForCustomerResponse){
option (google.api.http) = {
get: "/Customer/GetUser"
};
};
rpc UpdateCustomerProfile(UpdateCustomerProfileRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/Customer/UpdateProfile"
body: "*"
};
};
rpc GetCustomerProfile(GetCustomerProfileRequest) returns (GetCustomerProfileResponse){
option (google.api.http) = {
get: "/Customer/GetProfile"
};
};
rpc ChangeCustomerPassword(ChangeCustomerPasswordRequest) returns (ChangeCustomerPasswordResponse){
option (google.api.http) = {
post: "/Customer/ChangePassword"
body: "*"
};
};
rpc GetCustomerReferrals(GetCustomerReferralsRequest) returns (GetCustomerReferralsResponse){
option (google.api.http) = {
get: "/Customer/GetReferrals"
};
};
rpc UploadCustomerAvatar(UploadCustomerAvatarRequest) returns (UploadCustomerAvatarResponse){
option (google.api.http) = {
post: "/Customer/UploadAvatar"
body: "*"
};
};
rpc GetCustomerSettings(GetCustomerSettingsRequest) returns (GetCustomerSettingsResponse){
option (google.api.http) = {
get: "/Customer/GetSettings"
};
};
rpc UpdateCustomerSettings(UpdateCustomerSettingsRequest) returns (google.protobuf.Empty){
option (google.api.http) = {
put: "/Customer/UpdateSettings"
body: "*"
};
};
}
message CreateNewUserRequest
{
@@ -129,7 +195,7 @@ message GetUserResponse
}
message GetAllUserByFilterRequest
{
messages.PaginationState pagination_state = 1;
city.PaginationState pagination_state = 1;
google.protobuf.StringValue sort_by = 2;
GetAllUserByFilterFilter filter = 3;
}
@@ -153,7 +219,7 @@ message GetAllUserByFilterFilter
}
message GetAllUserByFilterResponse
{
messages.MetaData meta_data = 1;
city.MetaData meta_data = 1;
repeated GetAllUserByFilterResponseModel models = 2;
}
message GetAllUserByFilterResponseModel
@@ -207,3 +273,193 @@ message RefreshTokenResponse
bool success = 2;
string message = 3;
}
message CreateNewOtpTokenRequest
{
string mobile = 1;
string purpose = 2;
google.protobuf.StringValue sign_guid = 3;
}
message CreateNewOtpTokenResponse
{
bool success = 1;
string message = 2;
int32 remaining_attempts = 3;
int32 remaining_seconds = 4;
}
message VerifyOtpTokenRequest
{
string mobile = 1;
string purpose = 2;
string code = 3;
google.protobuf.StringValue parent_referral_code = 4;
}
message VerifyOtpTokenResponse
{
bool success = 1;
string message = 2;
google.protobuf.StringValue token = 3;
int32 remaining_attempts = 4;
}
message AcceptContractRequest
{
string code = 1;
string contract_html = 2;
string sign_guid = 3;
}
message AcceptContractResponse
{
string token = 1;
}
message GetUserForCustomerRequest
{
// Empty request - user identified by token
}
message GetUserForCustomerResponse
{
int64 id = 1;
google.protobuf.StringValue first_name = 2;
google.protobuf.StringValue last_name = 3;
string mobile = 4;
google.protobuf.StringValue email = 5;
google.protobuf.StringValue national_code = 6;
google.protobuf.StringValue avatar_path = 7;
google.protobuf.Int64Value parent_id = 8;
string referral_code = 9;
bool is_mobile_verified = 10;
google.protobuf.Timestamp mobile_verified_at = 11;
bool email_notifications = 12;
bool sms_notifications = 13;
bool push_notifications = 14;
google.protobuf.Timestamp birth_date = 15;
}
// ============= Customer Profile Messages =============
message UpdateCustomerProfileRequest
{
google.protobuf.StringValue first_name = 1;
google.protobuf.StringValue last_name = 2;
google.protobuf.StringValue email = 3;
google.protobuf.StringValue national_code = 4;
google.protobuf.Timestamp birth_date = 5;
}
message GetCustomerProfileRequest
{
// Empty request - user identified by token
}
message GetCustomerProfileResponse
{
int64 id = 1;
google.protobuf.StringValue first_name = 2;
google.protobuf.StringValue last_name = 3;
string mobile = 4;
google.protobuf.StringValue email = 5;
google.protobuf.StringValue national_code = 6;
google.protobuf.StringValue avatar_path = 7;
google.protobuf.Int64Value parent_id = 8;
string referral_code = 9;
bool is_mobile_verified = 10;
google.protobuf.Timestamp mobile_verified_at = 11;
bool email_notifications = 12;
bool sms_notifications = 13;
bool push_notifications = 14;
google.protobuf.Timestamp birth_date = 15;
string full_name = 16;
int32 profile_completion_percentage = 17;
}
message ChangeCustomerPasswordRequest
{
string current_password = 1;
string new_password = 2;
string confirm_password = 3;
}
message ChangeCustomerPasswordResponse
{
bool success = 1;
string message = 2;
}
// ============= Customer Referrals Messages =============
message GetCustomerReferralsRequest
{
city.PaginationState pagination_state = 1;
google.protobuf.StringValue status_filter = 2; // ACTIVE, INACTIVE, ALL
}
message GetCustomerReferralsResponse
{
city.MetaData meta_data = 1;
repeated CustomerReferralModel referrals = 2;
CustomerReferralStats stats = 3;
}
message CustomerReferralModel
{
int64 id = 1;
google.protobuf.StringValue first_name = 2;
google.protobuf.StringValue last_name = 3;
string mobile = 4;
google.protobuf.Timestamp join_date = 5;
bool is_active = 6;
string status_message = 7;
int32 level = 8;
int64 total_commission = 9;
}
message CustomerReferralStats
{
int32 total_referrals = 1;
int32 active_referrals = 2;
int64 total_commission_earned = 3;
int64 this_month_commission = 4;
}
// ============= Customer Avatar Messages =============
message UploadCustomerAvatarRequest
{
string file_name = 1;
string file_mime_type = 2;
bytes file_data = 3;
}
message UploadCustomerAvatarResponse
{
bool success = 1;
string message = 2;
google.protobuf.StringValue avatar_url = 3;
}
// ============= Customer Settings Messages =============
message GetCustomerSettingsRequest
{
// Empty request - user identified by token
}
message GetCustomerSettingsResponse
{
bool email_notifications = 1;
bool sms_notifications = 2;
bool push_notifications = 3;
bool marketing_notifications = 4;
string preferred_language = 5;
string time_zone = 6;
bool two_factor_auth_enabled = 7;
}
message UpdateCustomerSettingsRequest
{
bool email_notifications = 1;
bool sms_notifications = 2;
bool push_notifications = 3;
bool marketing_notifications = 4;
google.protobuf.StringValue preferred_language = 5;
google.protobuf.StringValue time_zone = 6;
google.protobuf.BoolValue two_factor_auth_enabled = 7;
}