Skip to content

Commit

Permalink
feat: SetHost & GetHost
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenSheep402 committed Sep 17, 2023
1 parent 2b915f7 commit 0d77dfd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 3 deletions.
17 changes: 17 additions & 0 deletions proto/user/v1/user.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,27 @@ enum UserStatus {
USER_STATUS_WAIT_EMAIL_CHECK = 3; // 等待验证邮箱
}

enum HostSyncMode {
HOST_SYNC_MODE_UNSPECIFIED = 0;
HOST_SYNC_MODE_ENABLE = 1;// 同步到云端
HOST_SYNC_MODE_DISABLE = 2; // 不同步到云端
HOST_SYNC_MODE_ONCE = 3; // 一次销毁
}

message User {
string id = 1;
string nick_name = 2; // 用户名
UserStatus status = 3; // 用户状态
string avatar = 4; // 头像链接
string email = 5; // 邮箱
}

message Host {
string id = 1;
string owner = 2; // 所有者id
string name = 3;
string host = 4;
int32 port = 5;
string password = 6;
HostSyncMode sync_mode = 7;
}
42 changes: 39 additions & 3 deletions proto/user/v1/user_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,67 @@ service UserService {
body: "*"
};
}

rpc CheckEmailVerifyCode(CheckEmailVerifyCodeRequest) returns(CheckEmailVerifyCodeResponse) {
option(google.api.http) = {
post: "/gapi/user/v1/verify/email/check",
body: "*"
};
}
}

message GetInfoRequest {
rpc SetNewHost(SetNewHostRequest) returns(SetNewHostResponse) {
option(google.api.http) = {
post: "/gapi/user/v1/host/set",
body: "*"
};
}

rpc GetHost(GetHostRequest) returns(GetHostResponse) {
option(google.api.http) = {
post: "/gapi/user/v1/host/get",
body: "*"
};
}
}

// GetInfo
message GetInfoRequest {}

message GetInfoResponse {
User info = 1;
}

// SendEmailVerifyCode
message SendEmailVerifyCodeRequest {
string email = 1;
}

message SendEmailVerifyCodeResponse {}

// CheckEmailVerifyCode
message CheckEmailVerifyCodeRequest {
string email = 1;
string code = 2;
}

message CheckEmailVerifyCodeResponse {}
message CheckEmailVerifyCodeResponse {}

// SetNewHost
message SetNewHostRequest {
string name = 1;
string host = 2;
string port = 3;
string password = 4;
HostSyncMode sync_mode = 5;
}

message SetNewHostResponse {}

// GetHost
message GetHostRequest {
string id = 1; // 所有者id
}

message GetHostResponse {
repeated Host hosts = 1;
}

0 comments on commit 0d77dfd

Please sign in to comment.