update_member is changed

This commit is contained in:
병준 박 2022-08-16 06:08:49 +00:00
parent f8dcce0eba
commit 3c9ba78a06

View File

@ -324,10 +324,10 @@ impl Service<'_> {
if let Some(a) = request.bank_account {
let bank_id = uuid::Uuid::from_str(a.bank_id.as_str()).map_err(|e| {
bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams {
message: "invalid bank_id param".to_string(),
message: "invalid bank_account.bank_id param".to_string(),
detail: bcr::error::rpc::InvalidParamsDetail {
location: "request".to_string(),
param: "bank_id".to_string(),
param: "bank_account.bank_id".to_string(),
value: a.bank_id.clone(),
error_type: bcr::error::rpc::InvalidParamsType::Required,
message: e.to_string(),
@ -335,13 +335,41 @@ impl Service<'_> {
})
})?;
if a.exchange_password.trim().eq("") {
return Err(bcr::error::rpc::Error::InvalidParams(
bcr::error::rpc::InvalidParams {
message: "invalid bank_account.exchange_password param".to_string(),
detail: bcr::error::rpc::InvalidParamsDetail {
location: "request".to_string(),
param: "bank_account.exchange_password".to_string(),
value: a.exchange_password,
error_type: bcr::error::rpc::InvalidParamsType::Required,
message: "bank_account.exchange_password is required".to_string(),
},
},
));
}
let exchange_password_hash = argon2::hash_encoded(
a.exchange_password.as_bytes(),
self.password_salt.as_bytes(),
&self.argon2_config,
)
.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 new_member_bank_account =
repositories::member_bank_account::models::NewMemberBankAccount {
member_id: m.id,
bank_id,
name: a.name,
account_number: a.account_number,
exchange_password: a.exchange_password,
exchange_password: exchange_password_hash,
memo: None,
};
self
@ -1069,12 +1097,25 @@ impl Service<'_> {
})
})?;
let exchange_password_hash = argon2::hash_encoded(
a.exchange_password.as_bytes(),
self.password_salt.as_bytes(),
&self.argon2_config,
)
.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 modify_member_bank_account =
repositories::member_bank_account::models::ModifyMemberBankAccount {
bank_id,
name: a.name,
account_number: a.account_number,
exchange_password: a.exchange_password,
exchange_password: exchange_password_hash,
memo: None,
};
self