member is modified
This commit is contained in:
parent
7e0746ad2a
commit
f9e6c208ce
File diff suppressed because it is too large
Load Diff
|
@ -47,6 +47,14 @@ pub struct NewMemberGameSetting {
|
|||
pub can_bet_bogglepowerball: bool,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_game_settings"]
|
||||
pub struct NewMemberGameSettingForDefault {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_game_settings"]
|
||||
|
|
|
@ -40,6 +40,19 @@ impl Repository {
|
|||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert_with_default(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberGameSettingForDefault,
|
||||
) -> Result<models::MemberGameSetting, Error> {
|
||||
let inserted = diesel::insert_into(member_game_settings::table)
|
||||
.values(new_resource)
|
||||
.get_result::<models::MemberGameSetting>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
|
|
|
@ -103,6 +103,14 @@ pub struct NewMemberSettlementSetting {
|
|||
pub rate_bogglepowerball_combo: f64,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(Insertable, Debug, Clone)]
|
||||
#[table_name = "member_settlement_settings"]
|
||||
pub struct NewMemberSettlementSettingForDefault {
|
||||
///
|
||||
pub member_id: uuid::Uuid,
|
||||
}
|
||||
|
||||
///
|
||||
#[derive(AsChangeset, Debug, Clone)]
|
||||
#[table_name = "member_settlement_settings"]
|
||||
|
|
|
@ -40,6 +40,19 @@ impl Repository {
|
|||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn insert_with_default(
|
||||
&self,
|
||||
conn: &diesel::PgConnection,
|
||||
new_resource: &models::NewMemberSettlementSettingForDefault,
|
||||
) -> Result<models::MemberSettlementSetting, Error> {
|
||||
let inserted = diesel::insert_into(member_settlement_settings::table)
|
||||
.values(new_resource)
|
||||
.get_result::<models::MemberSettlementSetting>(conn)?;
|
||||
|
||||
Ok(inserted)
|
||||
}
|
||||
|
||||
///
|
||||
pub fn select(
|
||||
&self,
|
||||
|
|
|
@ -391,70 +391,106 @@ impl Service<'_> {
|
|||
})?;
|
||||
}
|
||||
|
||||
if let Some(a) = request.game_setting {
|
||||
let new_member_game_setting =
|
||||
repositories::member_game_setting::models::NewMemberGameSetting {
|
||||
member_id: m.id,
|
||||
can_bet_casino: a.can_bet_casino,
|
||||
can_bet_slot: a.can_bet_slot,
|
||||
can_bet_powerball: a.can_bet_powerball,
|
||||
can_bet_powerladder: a.can_bet_powerladder,
|
||||
can_bet_eos: a.can_bet_eos,
|
||||
can_bet_bogglepowerball: a.can_bet_bogglepowerball,
|
||||
};
|
||||
self
|
||||
.member_game_setting_repository
|
||||
.insert(&conn, &new_member_game_setting)
|
||||
.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,
|
||||
})
|
||||
})?;
|
||||
match request.game_setting {
|
||||
Some(a) => {
|
||||
let new_member_game_setting =
|
||||
repositories::member_game_setting::models::NewMemberGameSetting {
|
||||
member_id: m.id,
|
||||
can_bet_casino: a.can_bet_casino,
|
||||
can_bet_slot: a.can_bet_slot,
|
||||
can_bet_powerball: a.can_bet_powerball,
|
||||
can_bet_powerladder: a.can_bet_powerladder,
|
||||
can_bet_eos: a.can_bet_eos,
|
||||
can_bet_bogglepowerball: a.can_bet_bogglepowerball,
|
||||
};
|
||||
self
|
||||
.member_game_setting_repository
|
||||
.insert(&conn, &new_member_game_setting)
|
||||
.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,
|
||||
})
|
||||
})?;
|
||||
}
|
||||
None => {
|
||||
let new_member_game_setting =
|
||||
repositories::member_game_setting::models::NewMemberGameSettingForDefault {
|
||||
member_id: m.id,
|
||||
};
|
||||
self
|
||||
.member_game_setting_repository
|
||||
.insert_with_default(&conn, &new_member_game_setting)
|
||||
.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(a) = request.settlement_setting {
|
||||
let new_member_settlement_setting =
|
||||
repositories::member_settlement_setting::models::NewMemberSettlementSetting {
|
||||
member_id: m.id,
|
||||
can_exchange: a.can_exchange,
|
||||
can_first_charge_comp: a.can_first_charge_comp,
|
||||
can_per_charge_comp: a.can_per_charge_comp,
|
||||
manual_payment_type_for_partner:
|
||||
repositories::member_settlement_setting::schema::ManualPaymentType::from(
|
||||
a.manual_payment_type_for_partner,
|
||||
),
|
||||
settlement_type:
|
||||
repositories::member_settlement_setting::schema::SettlementType::from(
|
||||
a.settlement_type,
|
||||
),
|
||||
rate_casino: a.rate_casino,
|
||||
rate_casino_loosing: a.rate_casino_loosing,
|
||||
rate_casino_bacara: a.rate_casino_bacara,
|
||||
rate_casino_roulette: a.rate_casino_roulette,
|
||||
rate_casino_dragon_tiger: a.rate_casino_dragon_tiger,
|
||||
rate_slot: a.rate_slot,
|
||||
rate_slot_loosing: a.rate_slot_loosing,
|
||||
rate_powerball_single: a.rate_powerball_single,
|
||||
rate_powerball_combo: a.rate_powerball_combo,
|
||||
rate_powerladder_single: a.rate_powerladder_single,
|
||||
rate_powerladder_combo: a.rate_powerladder_combo,
|
||||
rate_eos_single: a.rate_eos_single,
|
||||
rate_eos_combo: a.rate_eos_combo,
|
||||
rate_bogglepowerball_single: a.rate_bogglepowerball_single,
|
||||
rate_bogglepowerball_combo: a.rate_bogglepowerball_combo,
|
||||
};
|
||||
self
|
||||
.member_settlement_setting_repository
|
||||
.insert(&conn, &new_member_settlement_setting)
|
||||
.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,
|
||||
})
|
||||
})?;
|
||||
match request.settlement_setting {
|
||||
Some(a) => {
|
||||
let new_member_settlement_setting =
|
||||
repositories::member_settlement_setting::models::NewMemberSettlementSetting {
|
||||
member_id: m.id,
|
||||
can_exchange: a.can_exchange,
|
||||
can_first_charge_comp: a.can_first_charge_comp,
|
||||
can_per_charge_comp: a.can_per_charge_comp,
|
||||
manual_payment_type_for_partner:
|
||||
repositories::member_settlement_setting::schema::ManualPaymentType::from(
|
||||
a.manual_payment_type_for_partner,
|
||||
),
|
||||
settlement_type:
|
||||
repositories::member_settlement_setting::schema::SettlementType::from(
|
||||
a.settlement_type,
|
||||
),
|
||||
rate_casino: a.rate_casino,
|
||||
rate_casino_loosing: a.rate_casino_loosing,
|
||||
rate_casino_bacara: a.rate_casino_bacara,
|
||||
rate_casino_roulette: a.rate_casino_roulette,
|
||||
rate_casino_dragon_tiger: a.rate_casino_dragon_tiger,
|
||||
rate_slot: a.rate_slot,
|
||||
rate_slot_loosing: a.rate_slot_loosing,
|
||||
rate_powerball_single: a.rate_powerball_single,
|
||||
rate_powerball_combo: a.rate_powerball_combo,
|
||||
rate_powerladder_single: a.rate_powerladder_single,
|
||||
rate_powerladder_combo: a.rate_powerladder_combo,
|
||||
rate_eos_single: a.rate_eos_single,
|
||||
rate_eos_combo: a.rate_eos_combo,
|
||||
rate_bogglepowerball_single: a.rate_bogglepowerball_single,
|
||||
rate_bogglepowerball_combo: a.rate_bogglepowerball_combo,
|
||||
};
|
||||
self
|
||||
.member_settlement_setting_repository
|
||||
.insert(&conn, &new_member_settlement_setting)
|
||||
.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,
|
||||
})
|
||||
})?;
|
||||
}
|
||||
None => {
|
||||
let new_member_settlement_setting =
|
||||
repositories::member_settlement_setting::models::NewMemberSettlementSettingForDefault {
|
||||
member_id: m.id,
|
||||
};
|
||||
self
|
||||
.member_settlement_setting_repository
|
||||
.insert_with_default(&conn, &new_member_settlement_setting)
|
||||
.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 member = self.member_composition.select(&conn, m.id).map_err(|e| {
|
||||
|
|
Loading…
Reference in New Issue
Block a user