From 0803ade97bbca89cf62094365de89b8a3b276063 Mon Sep 17 00:00:00 2001 From: PARK BYUNG JUN Date: Sun, 28 Aug 2022 03:18:04 +0000 Subject: [PATCH] events are added --- Cargo.toml | 4 +-- src/services/member_bank_deposit/service.rs | 28 +++++++++++++++++++- src/services/member_bank_withdraw/service.rs | 27 ++++++++++++++++++- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b592455..70a022e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,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.77-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.62-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.78-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.63-snapshot" } [build-dependencies] diff --git a/src/services/member_bank_deposit/service.rs b/src/services/member_bank_deposit/service.rs index e1dbf07..6d3ba4d 100644 --- a/src/services/member_bank_deposit/service.rs +++ b/src/services/member_bank_deposit/service.rs @@ -787,7 +787,33 @@ impl Service { result: Some( bpr::ss::member_bank_deposit::update_member_bank_deposit_response::Result { member_bank_deposit: s - .map(|d| bpr::models::member_bank_deposit::MemberBankDeposit::from(&d)), + .as_ref() + .map(bpr::models::member_bank_deposit::MemberBankDeposit::from), + }, + ), + } + .encode_to_vec(), + ) + .await + .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, + }) + })?; + + self + .connection_broker + .publish( + bpr::ss::member_bank_deposit::EVENT_SUBJECT_AFTER_UPDATE_MEMBER_BANK_DEPOSIT_FOR_STATE, + bpr::ss::member_bank_deposit::AfterUpdateMemberBankDepositForState { + client: Some(client), + event: Some( + bpr::ss::member_bank_deposit::after_update_member_bank_deposit_for_state::Event { + member_bank_deposit: s + .as_ref() + .map(bpr::models::member_bank_deposit::MemberBankDeposit::from), }, ), } diff --git a/src/services/member_bank_withdraw/service.rs b/src/services/member_bank_withdraw/service.rs index 388f7c4..26008d0 100644 --- a/src/services/member_bank_withdraw/service.rs +++ b/src/services/member_bank_withdraw/service.rs @@ -792,8 +792,33 @@ impl Service { error: None, result: Some( bpr::ss::member_bank_withdraw::update_member_bank_withdraw_for_state_response::Result { + member_bank_withdraw: s.as_ref() + .map(bpr::models::member_bank_withdraw::MemberBankWithdraw::from), + }, + ), + } + .encode_to_vec(), + ) + .await + .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, + }) + })?; + + self + .connection_broker + .publish( + bpr::ss::member_bank_withdraw::EVENT_SUBJECT_AFTER_UPDATE_MEMBER_BANK_WITHDRAW_FOR_STATE, + bpr::ss::member_bank_withdraw::AfterUpdateMemberBankWithdrawForState { + client: Some(client), + event: Some( + bpr::ss::member_bank_withdraw::after_update_member_bank_withdraw_for_state::Event { member_bank_withdraw: s - .map(|d| bpr::models::member_bank_withdraw::MemberBankWithdraw::from(&d)), + .as_ref() + .map(bpr::models::member_bank_withdraw::MemberBankWithdraw::from), }, ), }