Files
contracts/proto/users/users.proto
Дмитрий b7f219d499
All checks were successful
Publish / Publish Job (push) Successful in 2m23s
feat: add methods for chats
2026-04-17 17:48:53 +03:00

132 lines
3.7 KiB
Protocol Buffer

syntax = "proto3";
package users.v1;
option go_package = "git.lendry.ru/lendry-erp/proto.git/go;pb";
service UsersService {
rpc GetProfile (GetProfileRequest) returns (GetProfileResponse);
rpc UpdateProfile (UpdateProfileRequest) returns (UpdateProfileResponse);
// Для системного использования (вызывается из Auth/Admin)
rpc CreateProfile (CreateProfileRequest) returns (CreateProfileResponse);
rpc SoftDeleteProfile(SoftDeleteProfileRequest) returns (SoftDeleteProfileResponse);
// --- НОВЫЕ МЕТОДЫ МЕССЕНДЖЕРА ---
rpc BlockUser (BlockUserRequest) returns (BlockUserResponse);
rpc UnblockUser (UnblockUserRequest) returns (UnblockUserResponse);
rpc GetBlockedUsers (GetBlockedUsersRequest) returns (GetBlockedUsersResponse);
rpc AddContact (AddContactRequest) returns (AddContactResponse);
rpc GetContacts (GetContactsRequest) returns (GetContactsResponse);
}
message UserSettingsMessage {
string privacy_phone = 1;
string privacy_last_seen = 2;
string privacy_photo = 3;
string privacy_bio = 4;
string privacy_calls = 5;
string privacy_groups = 6;
string privacy_voice_msgs = 7;
bool notify_private_chats = 8;
bool notify_groups = 9;
bool notify_channels = 10;
bool show_message_preview = 11;
string theme = 12;
int32 text_size = 13;
optional string chat_background = 14;
}
message GetProfileRequest {
string user_id = 1; // Берется из access токена на API шлюзе
}
message GetProfileResponse {
string id = 1;
optional string email = 2;
optional string phone = 3;
optional string full_name = 4;
optional string avatar_url = 5;
bool is_public = 6;
string timezone = 7;
string language = 8;
optional string custom_status_text = 9;
optional string custom_status_emoji = 10;
optional UserSettingsMessage settings = 11;
}
message UpdateProfileRequest {
string user_id = 1;
optional string email = 2;
optional string phone = 3;
optional string full_name = 4;
optional string avatar_url = 5;
optional string custom_status_text = 6;
optional string custom_status_emoji = 7;
optional string timezone = 8;
optional string language = 9;
optional bool is_public = 10;
optional UserSettingsMessage settings = 11;
}
message UpdateProfileResponse {
bool success = 1;
string message = 2;
}
// Вызывается другими сервисами при создании аккаунта
message CreateProfileRequest {
string user_id = 1; // Обязательно передаем ID созданного аккаунта!
optional string email = 2;
optional string full_name = 3;
optional string phone = 4;
optional string avatar_url = 5;
}
message CreateProfileResponse {
bool success = 1;
}
message SoftDeleteProfileRequest {
string user_id = 1;
}
message SoftDeleteProfileResponse {
bool success = 1;
}
message ContactItem {
string contact_id = 1;
optional string alias = 2;
}
message AddContactRequest {
string user_id = 1;
string contact_id = 2;
optional string alias = 3;
}
message AddContactResponse { bool success = 1; }
message GetContactsRequest {
string user_id = 1;
}
message GetContactsResponse {
repeated ContactItem contacts = 1;
}
message BlockedUserItem {
string blocked_id = 1;
string blocked_at = 2;
}
message BlockUserRequest {
string blocker_id = 1;
string blocked_id = 2;
}
message BlockUserResponse { bool success = 1; }
message UnblockUserRequest {
string blocker_id = 1;
string blocked_id = 2;
}
message UnblockUserResponse { bool success = 1; }
message GetBlockedUsersRequest {
string blocker_id = 1;
}
message GetBlockedUsersResponse {
repeated BlockedUserItem blocked_users = 1;
}