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,
|
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)]
|
#[derive(AsChangeset, Debug, Clone)]
|
||||||
#[table_name = "member_game_settings"]
|
#[table_name = "member_game_settings"]
|
||||||
|
|
|
@ -40,6 +40,19 @@ impl Repository {
|
||||||
Ok(inserted)
|
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(
|
pub fn select(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -103,6 +103,14 @@ pub struct NewMemberSettlementSetting {
|
||||||
pub rate_bogglepowerball_combo: f64,
|
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)]
|
#[derive(AsChangeset, Debug, Clone)]
|
||||||
#[table_name = "member_settlement_settings"]
|
#[table_name = "member_settlement_settings"]
|
||||||
|
|
|
@ -40,6 +40,19 @@ impl Repository {
|
||||||
Ok(inserted)
|
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(
|
pub fn select(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -391,7 +391,8 @@ impl Service<'_> {
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(a) = request.game_setting {
|
match request.game_setting {
|
||||||
|
Some(a) => {
|
||||||
let new_member_game_setting =
|
let new_member_game_setting =
|
||||||
repositories::member_game_setting::models::NewMemberGameSetting {
|
repositories::member_game_setting::models::NewMemberGameSetting {
|
||||||
member_id: m.id,
|
member_id: m.id,
|
||||||
|
@ -413,8 +414,26 @@ impl Service<'_> {
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
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 {
|
match request.settlement_setting {
|
||||||
|
Some(a) => {
|
||||||
let new_member_settlement_setting =
|
let new_member_settlement_setting =
|
||||||
repositories::member_settlement_setting::models::NewMemberSettlementSetting {
|
repositories::member_settlement_setting::models::NewMemberSettlementSetting {
|
||||||
member_id: m.id,
|
member_id: m.id,
|
||||||
|
@ -456,6 +475,23 @@ impl Service<'_> {
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
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| {
|
let member = self.member_composition.select(&conn, m.id).map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user