From ad97b8b5505c65cff306d9bd65b3f29a9fac7cd8 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Wed, 7 Sep 2022 04:08:37 +0000 Subject: [PATCH] methods are modified --- Cargo.toml | 4 +- src/compositions/member/composition.rs | 61 ++++++++++----------- src/compositions/member/models.rs | 2 +- src/synchronizations/member/synchronizer.rs | 14 ++--- 4 files changed, 39 insertions(+), 42 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 733a612..5c49b0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tokio-cron-scheduler = { version = "0" } uuid = { version = "0", features = ["serde", "v4", "v5"] } -beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.95-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.81-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.96-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.82-snapshot" } [build-dependencies] diff --git a/src/compositions/member/composition.rs b/src/compositions/member/composition.rs index 03e6f95..98aa7df 100644 --- a/src/compositions/member/composition.rs +++ b/src/compositions/member/composition.rs @@ -47,7 +47,7 @@ impl Composition { } }; - let ss_get_member_req = bpr::ss::member::GetMemberRequest { + let ss_get_member_req = bpr::ss::member::GetMemberBRequest { client: Some(bpr::models::core::network::Client { client_ip: self .connection_broker @@ -57,7 +57,7 @@ impl Composition { site_url: None, access_token: None, }), - request: Some(bpr::ss::member::get_member_request::Request { + request: Some(bpr::ss::member::get_member_b_request::Request { id: m.member_id.to_string(), }), }; @@ -65,7 +65,7 @@ impl Composition { let ss_get_member_res_msg = self .connection_broker .request( - bpr::ss::member::SUBJECT_GET_MEMBER, + bpr::ss::member::SUBJECT_GET_MEMBER_B, ss_get_member_req.encode_to_vec(), ) .await @@ -77,15 +77,16 @@ impl Composition { }) })?; - let ss_get_member_res = - bpr::ss::member::GetMemberByUsernameResponse::decode(ss_get_member_res_msg.data.as_slice()) - .map_err(|e| { - bcr::error::rpc::Error::Server(bcr::error::rpc::Server { - code: bpr::protobuf::rpc::Error::SERVER_00, - message: format!("server {}", e), - data: None, - }) - })?; + let ss_get_member_res = bpr::ss::member::GetMemberBResponse::decode( + ss_get_member_res_msg.data.as_slice(), + ) + .map_err(|e| { + bcr::error::rpc::Error::Server(bcr::error::rpc::Server { + code: bpr::protobuf::rpc::Error::SERVER_00, + message: format!("server {}", e), + data: None, + }) + })?; if let Some(e) = ss_get_member_res.error { return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server { @@ -95,28 +96,24 @@ impl Composition { })); } - match ss_get_member_res.result { + let mm = match ss_get_member_res.result { Some(r) => match r.member { - Some(mm) => { - return Ok(Some(models::MemberModel { - id: m.id, - balance: m.balance, - balance_bota: m.balance_bota, - balance_sum: m.balance_sum, - companies: m.companies, - oriental_play: m.oriental_play, - member: mm, - created_at: m.created_at, - updated_at: m.updated_at, - })); - } - None => { - return Ok(None); - } + Some(_m) => Some(models::MemberModel { + id: m.id, + balance: m.balance, + balance_bota: m.balance_bota, + balance_sum: m.balance_sum, + companies: m.companies, + oriental_play: m.oriental_play, + member: _m, + created_at: m.created_at, + updated_at: m.updated_at, + }), + None => None, }, - None => { - return Ok(None); - } + None => None, }; + + Ok(mm) } } diff --git a/src/compositions/member/models.rs b/src/compositions/member/models.rs index 00c3c69..b97fd00 100644 --- a/src/compositions/member/models.rs +++ b/src/compositions/member/models.rs @@ -16,7 +16,7 @@ pub struct MemberModel { /// pub oriental_play: String, /// - pub member: bpr::models::member::MemberModel, + pub member: bpr::models::member::Member, /// pub created_at: i64, /// diff --git a/src/synchronizations/member/synchronizer.rs b/src/synchronizations/member/synchronizer.rs index ba9482d..8c03726 100644 --- a/src/synchronizations/member/synchronizer.rs +++ b/src/synchronizations/member/synchronizer.rs @@ -96,7 +96,7 @@ impl Synchronizer { } .is_none() { - let ss_get_member_by_username_req = bpr::ss::member::GetMemberByUsernameRequest { + let ss_get_member_by_username_req = bpr::ss::member::GetMemberBByUsernameRequest { client: Some(bpr::models::core::network::Client { client_ip: self .connection_broker @@ -106,7 +106,7 @@ impl Synchronizer { site_url: None, access_token: None, }), - request: Some(bpr::ss::member::get_member_by_username_request::Request { + request: Some(bpr::ss::member::get_member_b_by_username_request::Request { username: u.site_username.clone(), }), }; @@ -114,7 +114,7 @@ impl Synchronizer { let ss_get_member_by_username_res_msg = match self .connection_broker .request( - bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME, + bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME, ss_get_member_by_username_req.encode_to_vec(), ) .await @@ -124,7 +124,7 @@ impl Synchronizer { return Err(api::core::models::Error { code: -1, msg: Some(format!( - "bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME: {}", + "bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME: {}", e )), }); @@ -132,7 +132,7 @@ impl Synchronizer { }; let ss_get_member_by_username_res = - match bpr::ss::member::GetMemberByUsernameResponse::decode( + match bpr::ss::member::GetMemberBByUsernameResponse::decode( ss_get_member_by_username_res_msg.data.as_slice(), ) { Ok(r) => r, @@ -140,7 +140,7 @@ impl Synchronizer { return Err(api::core::models::Error { code: -1, msg: Some(format!( - "bpr::ss::member::GetMemberByUsernameResponse: {}", + "bpr::ss::member::GetMemberBByUsernameResponse: {}", e )), }); @@ -151,7 +151,7 @@ impl Synchronizer { return Err(api::core::models::Error { code: -1, msg: Some(format!( - "bpr::ss::member::SUBJECT_GET_MEMBER_BY_USERNAME error: {}", + "bpr::ss::member::SUBJECT_GET_MEMBER_B_BY_USERNAME error: {}", e )), });