From 0d77dfdc906264bca866fbbcd5b1d5b2f66b3f05 Mon Sep 17 00:00:00 2001 From: GoldenSheep Date: Sun, 17 Sep 2023 18:19:00 +0800 Subject: [PATCH] feat: SetHost & GetHost --- proto/user/v1/user.proto | 17 +++++++++++++ proto/user/v1/user_service.proto | 42 +++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/proto/user/v1/user.proto b/proto/user/v1/user.proto index 29e0a27..e73e5cd 100644 --- a/proto/user/v1/user.proto +++ b/proto/user/v1/user.proto @@ -9,6 +9,13 @@ 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; // 用户名 @@ -16,3 +23,13 @@ message User { 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; +} \ No newline at end of file diff --git a/proto/user/v1/user_service.proto b/proto/user/v1/user_service.proto index 2479505..ef9e377 100644 --- a/proto/user/v1/user_service.proto +++ b/proto/user/v1/user_service.proto @@ -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 {} \ No newline at end of file +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; +}