117 lines
2.8 KiB
Protocol Buffer
117 lines
2.8 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
|
|
package app;
|
|
option go_package = "./app";
|
|
import "google/protobuf/struct.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
message UserInfo {
|
|
optional uint64 id = 1;
|
|
optional string username = 2;
|
|
optional string email = 3;
|
|
optional string mobile = 4;
|
|
optional string password_hash = 5;
|
|
optional string salt = 6;
|
|
string nickName = 7;
|
|
optional string avatar = 8;
|
|
optional string gender = 9;
|
|
optional string account_status = 10;
|
|
optional uint32 is_verified = 11;
|
|
optional int64 last_login_at = 12;
|
|
optional string last_login_ip = 13;
|
|
optional int64 login_attempts = 14;
|
|
optional int64 locked_until = 15;
|
|
optional string recovery_token = 16;
|
|
optional int64 recovery_token_expiry = 17;
|
|
optional google.protobuf.Struct metadata = 20;
|
|
optional string registration_source = 21;
|
|
optional int64 birthday_at = 22;
|
|
optional int64 created_at = 23; // 创建时间
|
|
optional int64 updated_at = 24;
|
|
}
|
|
|
|
|
|
message RegisterUserRequest {
|
|
optional string email = 1;
|
|
optional string password = 2;
|
|
optional string username = 3;
|
|
optional string name = 4;
|
|
optional string mobile = 5;
|
|
optional string captcha = 6;
|
|
optional uint32 verificationType = 7;
|
|
optional string nickName = 9;
|
|
optional string registrationSource = 10;
|
|
optional string gender = 11;
|
|
}
|
|
message RegisterUserResponse {
|
|
UserInfo user = 1;
|
|
AuthToken auth_token = 2;
|
|
bool email_verification_required = 3;
|
|
bool phone_verification_required = 4;
|
|
}
|
|
|
|
// 认证令牌
|
|
message AuthToken {
|
|
string access_token = 1;
|
|
string refresh_token = 2;
|
|
string token_type = 3;
|
|
google.protobuf.Timestamp access_token_expires = 4;
|
|
google.protobuf.Timestamp refresh_token_expires = 5;
|
|
}
|
|
|
|
message LoginResponse{
|
|
UserInfo user = 1;
|
|
AuthToken auth_token = 2;
|
|
}
|
|
message LoginRequest {
|
|
optional string username = 1;
|
|
optional string password = 2;
|
|
optional string clientIp = 3;
|
|
optional string loginTyp = 4;
|
|
optional string loginPlatform = 5;
|
|
}
|
|
message PageUserRequest {
|
|
uint64 page = 1;
|
|
uint64 page_size = 2;
|
|
optional string username = 3;
|
|
optional string email = 4;
|
|
optional string mobile = 5;
|
|
optional string status = 6;
|
|
optional string clientIp = 7;
|
|
}
|
|
|
|
message PageUserResponse {
|
|
uint64 total = 1;
|
|
repeated UserInfo data = 2;
|
|
}
|
|
message UserToken {
|
|
string access_token = 1;
|
|
uint64 user_id = 2;
|
|
}
|
|
message LogoutUserRequest {
|
|
string access_token = 1;
|
|
}
|
|
message UpdateUserPcPasswordReq{
|
|
|
|
}
|
|
message UpdateUserAvatarReq{
|
|
|
|
}
|
|
|
|
|
|
|
|
// App 服务定义
|
|
service App {
|
|
// 用户注册
|
|
// group: user
|
|
rpc RegisterUser(RegisterUserRequest) returns (RegisterUserResponse);
|
|
// 用户登录
|
|
// group: user
|
|
rpc LoginUser(LoginRequest) returns (LoginResponse);
|
|
// 分页查询用户信息
|
|
// group: user
|
|
rpc ListUsers(PageUserRequest) returns (PageUserResponse);
|
|
// 用户退出登录
|
|
// group: user
|
|
rpc LogoutUser(UserToken) returns (LogoutUserRequest);
|
|
} |