From 6b87a84801a1ab8605537efd09f2d6268310d4cc Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Wed, 27 Jul 2022 06:45:53 +0000 Subject: [PATCH] refactoring --- build.rs | 3 ++ proto/c2se/backend/identity.proto | 16 +++-------- proto/c2se/common/identity.proto | 36 ++++++++++++++++++++++++ proto/c2se/frontend/identity.proto | 16 +++-------- proto/models/core/network.proto | 6 ++-- proto/models/member/member_session.proto | 14 +++++++++ proto/ss/member/identity.proto | 33 +++++++++++++++++++--- 7 files changed, 93 insertions(+), 31 deletions(-) create mode 100644 proto/c2se/common/identity.proto create mode 100644 proto/models/member/member_session.proto diff --git a/build.rs b/build.rs index 2381388..9cece3b 100644 --- a/build.rs +++ b/build.rs @@ -39,12 +39,15 @@ static TARGETS: Lazy>> = Lazy::new(|| { "./proto/models/member/member_level.proto", "./proto/models/member/member_site.proto", "./proto/models/member/member.proto", + "./proto/models/member/member_session.proto", ], ); m.insert( "c2se", vec![ + "./proto/c2se/core/network.proto", + "./proto/c2se/common/identity.proto", "./proto/c2se/backend/identity.proto", "./proto/c2se/backend/member.proto", "./proto/c2se/frontend/identity.proto", diff --git a/proto/c2se/backend/identity.proto b/proto/c2se/backend/identity.proto index a2345bd..53a9cbe 100644 --- a/proto/c2se/backend/identity.proto +++ b/proto/c2se/backend/identity.proto @@ -4,20 +4,12 @@ package bet.beteran.c2se.backend.identity; import "protobuf/rpc/error.proto"; -// subject = bet.beteran.c2se.backend.identity.Captcha -message CaptchaRequest { -} - -message CaptchaResponse { - optional bet.protobuf.rpc.Error error = 1; - optional string image = 2; -} - // subject = bet.beteran.c2se.backend.identity.Signin message SigninRequest { - string username = 1; - string password = 2; - string security_code = 3; + string token = 1; + string security_code = 2; + string username = 3; + string password = 4; } message SigninResponse { diff --git a/proto/c2se/common/identity.proto b/proto/c2se/common/identity.proto new file mode 100644 index 0000000..1c8b54d --- /dev/null +++ b/proto/c2se/common/identity.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package bet.beteran.c2se.common.identity; + +import "protobuf/rpc/error.proto"; + +// subject = bet.beteran.c2se.common.identity.CheckUsernameForDuplication; +message CheckUsernameForDuplicationRequest { + string username = 1; +} + +message CheckUsernameForDuplicationResponse { + optional bet.protobuf.rpc.Error error = 1; + optional bool duplicated = 2; +} + +// subject = bet.beteran.c2se.common.identity.CheckNicknameForDuplication; +message CheckNicknameForDuplicationRequest { + string nickname = 1; +} + +message CheckNicknameForDuplicationResponse { + optional bet.protobuf.rpc.Error error = 1; + optional bool duplicated = 2; +} + + +// subject = bet.beteran.c2se.common.identity.Captcha +message CaptchaRequest { +} + +message CaptchaResponse { + optional bet.protobuf.rpc.Error error = 1; + optional string token = 2; + optional string image = 3; +} diff --git a/proto/c2se/frontend/identity.proto b/proto/c2se/frontend/identity.proto index 746313b..74ae9ae 100644 --- a/proto/c2se/frontend/identity.proto +++ b/proto/c2se/frontend/identity.proto @@ -4,20 +4,12 @@ package bet.beteran.c2se.frontend.identity; import "protobuf/rpc/error.proto"; -// subject = bet.beteran.c2se.frontend.identity.Captcha -message CaptchaRequest { -} - -message CaptchaResponse { - optional bet.protobuf.rpc.Error error = 1; - optional string image = 2; -} - // subject = bet.beteran.c2se.frontend.identity.Signin message SigninRequest { - string username = 1; - string password = 2; - string security_code = 3; + string token = 1; + string security_code = 2; + string username = 3; + string password = 4; } message SigninResponse { diff --git a/proto/models/core/network.proto b/proto/models/core/network.proto index 7e17c58..46ef7cb 100644 --- a/proto/models/core/network.proto +++ b/proto/models/core/network.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package bet.beteran.core.network; message Client { - optional string site_url = 1; - uint64 client_id = 2; - string client_ip = 3; + string client_ip = 1; + optional string site_url = 2; + optional string access_token = 3; } diff --git a/proto/models/member/member_session.proto b/proto/models/member/member_session.proto new file mode 100644 index 0000000..bd073fe --- /dev/null +++ b/proto/models/member/member_session.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package bet.beteran.member; + +import "models/member/member.proto"; + +message MemberSession { + string id = 1; + Member member = 2; + string data = 3; + uint64 last_accessed_at = 4; + uint64 expires_at = 5; + uint64 created_at = 6; +} diff --git a/proto/ss/member/identity.proto b/proto/ss/member/identity.proto index 9c99677..3ac79c4 100644 --- a/proto/ss/member/identity.proto +++ b/proto/ss/member/identity.proto @@ -5,6 +5,29 @@ package bet.beteran.ss.member.identity; import "protobuf/rpc/error.proto"; import "models/core/network.proto"; + +// subject = bet.beteran.ss.member.identity.CheckUsernameForDuplication; +message CheckUsernameForDuplicationRequest { + bet.beteran.core.network.Client client = 1; + string username = 2; +} + +message CheckUsernameForDuplicationResponse { + optional bet.protobuf.rpc.Error error = 1; + optional bool duplicated = 2; +} + +// subject = bet.beteran.ss.member.identity.CheckNicknameForDuplication; +message CheckNicknameForDuplicationRequest { + bet.beteran.core.network.Client client = 1; + string nickname = 2; +} + +message CheckNicknameForDuplicationResponse { + optional bet.protobuf.rpc.Error error = 1; + optional bool duplicated = 2; +} + // subject = bet.beteran.ss.member.identity.Captcha message CaptchaRequest { bet.beteran.core.network.Client client = 1; @@ -12,16 +35,18 @@ message CaptchaRequest { message CaptchaResponse { optional bet.protobuf.rpc.Error error = 1; - optional string image = 2; + optional string token = 2; + optional string image = 3; } // subject = bet.beteran.ss.member.identity.Signin message SigninRequest { bet.beteran.core.network.Client client = 1; - string username = 2; - string password = 3; - string security_code = 4; + string token = 2; + string security_code = 3; + string username = 4; + string password = 5; } message SigninResponse {