model is modified

This commit is contained in:
병준 박 2022-09-01 09:38:50 +00:00
parent 5c2d472bfc
commit a24d3dddb0
4 changed files with 535 additions and 231 deletions

View File

@ -36,7 +36,7 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio-cron-scheduler = { version = "0" } tokio-cron-scheduler = { version = "0" }
uuid = { version = "0", features = ["serde", "v4", "v5"] } uuid = { version = "0", features = ["serde", "v4", "v5"] }
beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.89-snapshot" } beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.92-snapshot" }
beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.75-snapshot" } beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.78-snapshot" }
[build-dependencies] [build-dependencies]

View File

@ -25,122 +25,216 @@ SELECT
m.updated_at as m_updated_at, m.updated_at as m_updated_at,
m.deleted_at as m_deleted_at, m.deleted_at as m_deleted_at,
s.id as s_id, m_s.id as m_s_id,
s.url as s_url, m_s.url as m_s_url,
s.name as s_name, m_s.name as m_s_name,
s.path as s_path, m_s.path as m_s_path,
s.show as s_show, m_s.show as m_s_show,
s.can_use as s_can_use, m_s.can_use as m_s_can_use,
s.memo as s_memo, m_s.memo as m_s_memo,
s.expires_at as s_expires_at, m_s.expires_at as m_s_expires_at,
s.created_at as s_created_at, m_s.created_at as m_s_created_at,
s.updated_at as s_updated_at, m_s.updated_at as m_s_updated_at,
mc.id as mc_id, m_mc.id as m_mc_id,
mc.parent_id as mc_parent_id, m_mc.parent_id as m_mc_parent_id,
mc.name as mc_name, m_mc.name as m_mc_name,
mc.show as mc_show, m_mc.show as m_mc_show,
mc.created_at as mc_created_at, m_mc.created_at as m_mc_created_at,
mc.updated_at as mc_updated_at, m_mc.updated_at as m_mc_updated_at,
ml.id as ml_id, m_ml.id as m_ml_id,
ml.name as ml_name, m_ml.name as m_ml_name,
ml.show as ml_show, m_ml.show as m_ml_show,
ml.sort_order as ml_sort_order, m_ml.sort_order as m_ml_sort_order,
ml.created_at as ml_created_at, m_ml.created_at as m_ml_created_at,
ml.updated_at as ml_updated_at, m_ml.updated_at as m_ml_updated_at,
_m.id as _m_id, m_mgs.id as m_mgs_id,
_m.site_id as _m_site_id, m_mgs.member_id as m_mgs_member_id,
_m.member_class_id as _m_member_class_id, m_mgs.can_bet_casino as m_mgs_can_bet_casino,
_m.member_level_id as _m_member_level_id, m_mgs.can_bet_slot as m_mgs_can_bet_slot,
_m.username as _m_username, m_mgs.can_bet_powerball as m_mgs_can_bet_powerball,
_m.password as _m_password, m_mgs.can_bet_powerladder as m_mgs_can_bet_powerladder,
_m.nickname as _m_nickname, m_mgs.can_bet_eos as m_mgs_can_bet_eos,
_m.mobile_phone_number as _m_mobile_phone_number, m_mgs.can_bet_bogglepowerball as m_mgs_can_bet_bogglepowerball,
_m.state as _m_state, m_mgs.created_at as m_mgs_created_at,
_m.state_changed_at as _m_state_changed_at, m_mgs.updated_at as m_mgs_updated_at,
_m.parent_member_id as _m_parent_member_id,
_m.child_member_count as _m_child_member_count,
_m.last_signined_ip as _m_last_signined_ip,
_m.last_signined_at as _m_last_signined_at,
_m.created_at as _m_created_at,
_m.updated_at as _m_updated_at,
_m.deleted_at as _m_deleted_at,
mgs.id as mgs_id, m_mss.id as m_mss_id,
mgs.member_id as mgs_member_id, m_mss.member_id as m_mss_member_id,
mgs.can_bet_casino as mgs_can_bet_casino, m_mss.can_exchange as m_mss_can_exchange,
mgs.can_bet_slot as mgs_can_bet_slot, m_mss.can_first_charge_comp as m_mss_can_first_charge_comp,
mgs.can_bet_powerball as mgs_can_bet_powerball, m_mss.can_per_charge_comp as m_mss_can_per_charge_comp,
mgs.can_bet_powerladder as mgs_can_bet_powerladder, m_mss.manual_payment_type_for_partner as m_mss_manual_payment_type_for_partner,
mgs.can_bet_eos as mgs_can_bet_eos, m_mss.settlement_type as m_mss_settlement_type,
mgs.can_bet_bogglepowerball as mgs_can_bet_bogglepowerball, m_mss.rate_casino as m_mss_rate_casino,
mgs.created_at as mgs_created_at, m_mss.rate_casino_loosing as m_mss_rate_casino_loosing,
mgs.updated_at as mgs_updated_at, m_mss.rate_casino_bacara as m_mss_rate_casino_bacara,
m_mss.rate_casino_roulette as m_mss_rate_casino_roulette,
m_mss.rate_casino_dragon_tiger as m_mss_rate_casino_dragon_tiger,
m_mss.rate_slot as m_mss_rate_slot,
m_mss.rate_slot_loosing as m_mss_rate_slot_loosing,
m_mss.rate_powerball_single as m_mss_rate_powerball_single,
m_mss.rate_powerball_combo as m_mss_rate_powerball_combo,
m_mss.rate_powerladder_single as m_mss_rate_powerladder_single,
m_mss.rate_powerladder_combo as m_mss_rate_powerladder_combo,
m_mss.rate_eos_single as m_mss_rate_eos_single,
m_mss.rate_eos_combo as m_mss_rate_eos_combo,
m_mss.rate_bogglepowerball_single as m_mss_rate_bogglepowerball_single,
m_mss.rate_bogglepowerball_combo as m_mss_rate_bogglepowerball_combo,
m_mss.created_at as m_mss_created_at,
m_mss.updated_at as m_mss_updated_at,
mss.id as mss_id, m_mba.id as m_mba_id,
mss.member_id as mss_member_id, m_mba.member_id as m_mba_member_id,
mss.can_exchange as mss_can_exchange, m_mba.bank_id as m_mba_bank_id,
mss.can_first_charge_comp as mss_can_first_charge_comp, m_mba.name as m_mba_name,
mss.can_per_charge_comp as mss_can_per_charge_comp, m_mba.account_number as m_mba_account_number,
mss.manual_payment_type_for_partner as mss_manual_payment_type_for_partner, m_mba.exchange_password as m_mba_exchange_password,
mss.settlement_type as mss_settlement_type, m_mba.memo as m_mba_memo,
mss.rate_casino as mss_rate_casino, m_mba.created_at as m_mba_created_at,
mss.rate_casino_loosing as mss_rate_casino_loosing, m_mba.updated_at as m_mba_updated_at,
mss.rate_casino_bacara as mss_rate_casino_bacara,
mss.rate_casino_roulette as mss_rate_casino_roulette,
mss.rate_casino_dragon_tiger as mss_rate_casino_dragon_tiger,
mss.rate_slot as mss_rate_slot,
mss.rate_slot_loosing as mss_rate_slot_loosing,
mss.rate_powerball_single as mss_rate_powerball_single,
mss.rate_powerball_combo as mss_rate_powerball_combo,
mss.rate_powerladder_single as mss_rate_powerladder_single,
mss.rate_powerladder_combo as mss_rate_powerladder_combo,
mss.rate_eos_single as mss_rate_eos_single,
mss.rate_eos_combo as mss_rate_eos_combo,
mss.rate_bogglepowerball_single as mss_rate_bogglepowerball_single,
mss.rate_bogglepowerball_combo as mss_rate_bogglepowerball_combo,
mss.created_at as mss_created_at,
mss.updated_at as mss_updated_at,
mba.id as mba_id,
mba.member_id as mba_member_id,
mba.bank_id as mba_bank_id,
mba.name as mba_name,
mba.account_number as mba_account_number,
mba.exchange_password as mba_exchange_password,
mba.memo as mba_memo,
mba.created_at as mba_created_at,
mba.updated_at as mba_updated_at,
_b.id as _b_id, m_mba_b.id as m_mba_b_id,
_b.name as _b_name, m_mba_b.name as m_mba_b_name,
_b.sort_order as _b_sort_order, m_mba_b.sort_order as m_mba_b_sort_order,
_b.show as _b_show, m_mba_b.show as m_mba_b_show,
_b.can_use as _b_can_use, m_mba_b.can_use as m_mba_b_can_use,
_b.memo as _b_memo, m_mba_b.memo as m_mba_b_memo,
_b.created_at as _b_created_at, m_mba_b.created_at as m_mba_b_created_at,
_b.updated_at as _b_updated_at m_mba_b.updated_at as m_mba_b_updated_at,
pm.id as pm_id,
pm.site_id as pm_site_id,
pm.member_class_id as pm_member_class_id,
pm.member_level_id as pm_member_level_id,
pm.username as pm_username,
pm.password as pm_password,
pm.nickname as pm_nickname,
pm.mobile_phone_number as pm_mobile_phone_number,
pm.state as pm_state,
pm.state_changed_at as pm_state_changed_at,
pm.parent_member_id as pm_parent_member_id,
pm.child_member_count as pm_child_member_count,
pm.last_signined_ip as pm_last_signined_ip,
pm.last_signined_at as pm_last_signined_at,
pm.created_at as pm_created_at,
pm.updated_at as pm_updated_at,
pm.deleted_at as pm_deleted_at,
pm_s.id as pm_s_id,
pm_s.url as pm_s_url,
pm_s.name as pm_s_name,
pm_s.path as pm_s_path,
pm_s.show as pm_s_show,
pm_s.can_use as pm_s_can_use,
pm_s.memo as pm_s_memo,
pm_s.expires_at as pm_s_expires_at,
pm_s.created_at as pm_s_created_at,
pm_s.updated_at as pm_s_updated_at,
pm_mc.id as pm_mc_id,
pm_mc.parent_id as pm_mc_parent_id,
pm_mc.name as pm_mc_name,
pm_mc.show as pm_mc_show,
pm_mc.created_at as pm_mc_created_at,
pm_mc.updated_at as pm_mc_updated_at,
pm_ml.id as pm_ml_id,
pm_ml.name as pm_ml_name,
pm_ml.show as pm_ml_show,
pm_ml.sort_order as pm_ml_sort_order,
pm_ml.created_at as pm_ml_created_at,
pm_ml.updated_at as pm_ml_updated_at,
pm_mgs.id as pm_mgs_id,
pm_mgs.member_id as pm_mgs_member_id,
pm_mgs.can_bet_casino as pm_mgs_can_bet_casino,
pm_mgs.can_bet_slot as pm_mgs_can_bet_slot,
pm_mgs.can_bet_powerball as pm_mgs_can_bet_powerball,
pm_mgs.can_bet_powerladder as pm_mgs_can_bet_powerladder,
pm_mgs.can_bet_eos as pm_mgs_can_bet_eos,
pm_mgs.can_bet_bogglepowerball as pm_mgs_can_bet_bogglepowerball,
pm_mgs.created_at as pm_mgs_created_at,
pm_mgs.updated_at as pm_mgs_updated_at,
pm_mss.id as pm_mss_id,
pm_mss.member_id as pm_mss_member_id,
pm_mss.can_exchange as pm_mss_can_exchange,
pm_mss.can_first_charge_comp as pm_mss_can_first_charge_comp,
pm_mss.can_per_charge_comp as pm_mss_can_per_charge_comp,
pm_mss.manual_payment_type_for_partner as pm_mss_manual_payment_type_for_partner,
pm_mss.settlement_type as pm_mss_settlement_type,
pm_mss.rate_casino as pm_mss_rate_casino,
pm_mss.rate_casino_loosing as pm_mss_rate_casino_loosing,
pm_mss.rate_casino_bacara as pm_mss_rate_casino_bacara,
pm_mss.rate_casino_roulette as pm_mss_rate_casino_roulette,
pm_mss.rate_casino_dragon_tiger as pm_mss_rate_casino_dragon_tiger,
pm_mss.rate_slot as pm_mss_rate_slot,
pm_mss.rate_slot_loosing as pm_mss_rate_slot_loosing,
pm_mss.rate_powerball_single as pm_mss_rate_powerball_single,
pm_mss.rate_powerball_combo as pm_mss_rate_powerball_combo,
pm_mss.rate_powerladder_single as pm_mss_rate_powerladder_single,
pm_mss.rate_powerladder_combo as pm_mss_rate_powerladder_combo,
pm_mss.rate_eos_single as pm_mss_rate_eos_single,
pm_mss.rate_eos_combo as pm_mss_rate_eos_combo,
pm_mss.rate_bogglepowerball_single as pm_mss_rate_bogglepowerball_single,
pm_mss.rate_bogglepowerball_combo as pm_mss_rate_bogglepowerball_combo,
pm_mss.created_at as pm_mss_created_at,
pm_mss.updated_at as pm_mss_updated_at,
pm_mba.id as pm_mba_id,
pm_mba.member_id as pm_mba_member_id,
pm_mba.bank_id as pm_mba_bank_id,
pm_mba.name as pm_mba_name,
pm_mba.account_number as pm_mba_account_number,
pm_mba.exchange_password as pm_mba_exchange_password,
pm_mba.memo as pm_mba_memo,
pm_mba.created_at as pm_mba_created_at,
pm_mba.updated_at as pm_mba_updated_at,
pm_mba_b.id as pm_mba_b_id,
pm_mba_b.name as pm_mba_b_name,
pm_mba_b.sort_order as pm_mba_b_sort_order,
pm_mba_b.show as pm_mba_b_show,
pm_mba_b.can_use as pm_mba_b_can_use,
pm_mba_b.memo as pm_mba_b_memo,
pm_mba_b.created_at as pm_mba_b_created_at,
pm_mba_b.updated_at as pm_mba_b_updated_at
FROM members as m FROM members as m
INNER JOIN sites s INNER JOIN sites m_s
ON s.id = m.site_id ON m_s.id = m.site_id
INNER JOIN member_classes mc INNER JOIN member_classes m_mc
ON mc.id = m.member_class_id ON m_mc.id = m.member_class_id
INNER JOIN member_levels ml INNER JOIN member_levels m_ml
ON ml.id = m.member_level_id ON m_ml.id = m.member_level_id
LEFT OUTER JOIN members _m LEFT OUTER JOIN member_settlement_settings m_mss
ON _m.id = m.parent_member_id ON m_mss.member_id = m.id
LEFT OUTER JOIN member_settlement_settings mss LEFT OUTER JOIN member_game_settings m_mgs
ON mss.member_id = m.id ON m_mgs.member_id = m.id
LEFT OUTER JOIN member_game_settings mgs LEFT OUTER JOIN member_bank_accounts m_mba
ON mgs.member_id = m.id ON m_mba.member_id = m.id
LEFT OUTER JOIN member_bank_accounts mba LEFT OUTER JOIN banks m_mba_b
ON mba.member_id = m.id ON m_mba_b.id = m_mba.bank_id
LEFT OUTER JOIN banks _b LEFT OUTER JOIN members pm
ON _b.id = mba.bank_id ON pm.id = m.parent_member_id
"; LEFT OUTER JOIN sites pm_s
ON pm_s.id = pm.site_id
LEFT OUTER JOIN member_classes pm_mc
ON pm_mc.id = pm.member_class_id
LEFT OUTER JOIN member_levels pm_ml
ON pm_ml.id = pm.member_level_id
LEFT OUTER JOIN member_settlement_settings pm_mss
ON pm_mss.member_id = pm.id
LEFT OUTER JOIN member_game_settings pm_mgs
ON pm_mgs.member_id = pm.id
LEFT OUTER JOIN member_bank_accounts pm_mba
ON pm_mba.member_id = pm.id
LEFT OUTER JOIN banks pm_mba_b
ON pm_mba_b.id = pm_mba.bank_id
";
pub struct Composition {} pub struct Composition {}

View File

@ -1,8 +1,8 @@
//! //!
//! //!
use crate::repositories::{ use crate::repositories::{
bank::models::Bank as _Bank, member::models::Member as _Member, bank::models::Bank as _Bank, member::schema::MemberState as _MemberState,
member::schema::MemberState as _MemberState, member_class::models::MemberClass as _MemberClass, member_class::models::MemberClass as _MemberClass,
member_game_setting::models::MemberGameSetting as _MemberGameSetting, member_game_setting::models::MemberGameSetting as _MemberGameSetting,
member_level::models::MemberLevel as _MemberLevel, member_level::models::MemberLevel as _MemberLevel,
member_settlement_setting::models::MemberSettlementSetting as _MemberSettlementSetting, member_settlement_setting::models::MemberSettlementSetting as _MemberSettlementSetting,
@ -10,6 +10,51 @@ use crate::repositories::{
}; };
use diesel::deserialize::QueryableByName; use diesel::deserialize::QueryableByName;
///
#[derive(PartialEq, PartialOrd, Debug, Clone)]
pub struct ParentMemberModel {
///
pub id: uuid::Uuid,
///
pub site: _Site,
///
pub member_class: _MemberClass,
///
pub member_level: _MemberLevel,
///
pub bank_account: Option<MemberBankAccountModel>,
///
pub username: String,
///
pub password: String,
///
pub nickname: String,
///
pub parent_member_id: Option<uuid::Uuid>,
///
pub child_member_count: i64,
///
pub mobile_phone_number: Option<String>,
///
pub state: _MemberState,
///
pub state_changed_at: Option<i64>,
///
pub member_game_setting: Option<_MemberGameSetting>,
///
pub member_settlement_setting: Option<_MemberSettlementSetting>,
///
pub last_signined_ip: Option<String>,
///
pub last_signined_at: Option<i64>,
///
pub created_at: i64,
///
pub updated_at: i64,
///
pub deleted_at: Option<i64>,
}
/// ///
#[derive(PartialEq, PartialOrd, Debug, Clone)] #[derive(PartialEq, PartialOrd, Debug, Clone)]
pub struct MemberModel { pub struct MemberModel {
@ -30,7 +75,7 @@ pub struct MemberModel {
/// ///
pub nickname: String, pub nickname: String,
/// ///
pub parent_member: Option<_Member>, pub parent_member: Option<ParentMemberModel>,
/// ///
pub child_member_count: i64, pub child_member_count: i64,
/// ///
@ -61,148 +106,272 @@ impl QueryableByName<diesel::pg::Pg> for MemberModel {
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>( .get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>(
"m_parent_member_id", "m_parent_member_id",
)? { )? {
Some(_) => Some(_Member { Some(_) => {
id: row.get("_m_id")?, let site = _Site {
site_id: row.get("_m_site_id")?, id: row.get("pm_s_id")?,
member_class_id: row.get("_m_member_class_id")?, url: row.get("pm_s_url")?,
member_level_id: row.get("_m_member_level_id")?, name: row.get("pm_s_name")?,
username: row.get("_m_username")?, path: row.get("pm_s_path")?,
password: row.get("_m_password")?, show: row.get("pm_s_show")?,
nickname: row.get("_m_nickname")?, can_use: row.get("pm_s_can_use")?,
mobile_phone_number: row.get("_m_mobile_phone_number")?, memo: row.get("pm_s_memo")?,
state: row.get("_m_state")?, expires_at: row.get("pm_s_expires_at")?,
state_changed_at: row.get("_m_state_changed_at")?, created_at: row.get("pm_s_created_at")?,
parent_member_id: row.get("_m_parent_member_id")?, updated_at: row.get("pm_s_updated_at")?,
child_member_count: row.get("_m_child_member_count")?, };
last_signined_ip: row.get("_m_last_signined_ip")?,
last_signined_at: row.get("_m_last_signined_at")?, let member_class = _MemberClass {
created_at: row.get("_m_created_at")?, id: row.get("pm_mc_id")?,
updated_at: row.get("_m_updated_at")?, parent_id: row.get("pm_mc_parent_id")?,
deleted_at: row.get("_m_deleted_at")?, name: row.get("pm_mc_name")?,
}), show: row.get("pm_mc_show")?,
created_at: row.get("pm_mc_created_at")?,
updated_at: row.get("pm_mc_updated_at")?,
};
let member_level = _MemberLevel {
id: row.get("pm_ml_id")?,
name: row.get("pm_ml_name")?,
show: row.get("pm_ml_show")?,
sort_order: row.get("pm_ml_sort_order")?,
created_at: row.get("pm_ml_created_at")?,
updated_at: row.get("pm_ml_updated_at")?,
};
let member_game_setting = match row
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>(
"pm_mgs_id",
)? {
Some(_) => Some(_MemberGameSetting {
id: row.get("pm_mgs_id")?,
member_id: row.get("pm_mgs_member_id")?,
can_bet_casino: row.get("pm_mgs_can_bet_casino")?,
can_bet_slot: row.get("pm_mgs_can_bet_slot")?,
can_bet_powerball: row.get("pm_mgs_can_bet_powerball")?,
can_bet_powerladder: row.get("pm_mgs_can_bet_powerladder")?,
can_bet_eos: row.get("pm_mgs_can_bet_eos")?,
can_bet_bogglepowerball: row.get("pm_mgs_can_bet_bogglepowerball")?,
created_at: row.get("pm_mgs_created_at")?,
updated_at: row.get("pm_mgs_updated_at")?,
}),
None => None,
};
let member_settlement_setting = match row.get::<diesel::sql_types::Nullable<
diesel::sql_types::Uuid,
>, Option<uuid::Uuid>>("pm_mss_id")?
{
Some(_) => Some(_MemberSettlementSetting {
id: row.get("pm_mss_id")?,
member_id: row.get("pm_mss_member_id")?,
can_exchange: row.get("pm_mss_can_exchange")?,
can_first_charge_comp: row.get("pm_mss_can_first_charge_comp")?,
can_per_charge_comp: row.get("pm_mss_can_per_charge_comp")?,
manual_payment_type_for_partner: row.get("pm_mss_manual_payment_type_for_partner")?,
settlement_type: row.get("pm_mss_settlement_type")?,
rate_casino: row.get("pm_mss_rate_casino")?,
rate_casino_loosing: row.get("pm_mss_rate_casino_loosing")?,
rate_casino_bacara: row.get("pm_mss_rate_casino_bacara")?,
rate_casino_roulette: row.get("pm_mss_rate_casino_roulette")?,
rate_casino_dragon_tiger: row.get("pm_mss_rate_casino_dragon_tiger")?,
rate_slot: row.get("pm_mss_rate_slot")?,
rate_slot_loosing: row.get("pm_mss_rate_slot_loosing")?,
rate_powerball_single: row.get("pm_mss_rate_powerball_single")?,
rate_powerball_combo: row.get("pm_mss_rate_powerball_combo")?,
rate_powerladder_single: row.get("pm_mss_rate_powerladder_single")?,
rate_powerladder_combo: row.get("pm_mss_rate_powerladder_combo")?,
rate_eos_single: row.get("pm_mss_rate_eos_single")?,
rate_eos_combo: row.get("pm_mss_rate_eos_combo")?,
rate_bogglepowerball_single: row.get("pm_mss_rate_bogglepowerball_single")?,
rate_bogglepowerball_combo: row.get("pm_mss_rate_bogglepowerball_combo")?,
created_at: row.get("pm_mss_created_at")?,
updated_at: row.get("pm_mss_updated_at")?,
}),
None => None,
};
let member_bank_account = match row
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>(
"pm_mba_id",
)? {
Some(_) => {
let bank = _Bank {
id: row.get("pm_mba_b_id")?,
name: row.get("pm_mba_b_name")?,
sort_order: row.get("pm_mba_b_sort_order")?,
show: row.get("pm_mba_b_show")?,
can_use: row.get("pm_mba_b_can_use")?,
memo: row.get("pm_mba_b_memo")?,
created_at: row.get("pm_mba_b_created_at")?,
updated_at: row.get("pm_mba_b_updated_at")?,
};
Some(MemberBankAccountModel {
id: row.get("pm_mba_id")?,
member_id: row.get("pm_mba_member_id")?,
bank,
name: row.get("pm_mba_name")?,
account_number: row.get("pm_mba_account_number")?,
exchange_password: row.get("pm_mba_exchange_password")?,
memo: row.get("pm_mba_memo")?,
created_at: row.get("pm_mba_created_at")?,
updated_at: row.get("pm_mba_updated_at")?,
})
}
None => None,
};
Some(ParentMemberModel {
id: row.get("pm_id")?,
site,
member_class,
member_level,
username: row.get("pm_username")?,
password: row.get("pm_password")?,
nickname: row.get("pm_nickname")?,
mobile_phone_number: row.get("pm_mobile_phone_number")?,
state: row.get("pm_state")?,
state_changed_at: row.get("pm_state_changed_at")?,
parent_member_id: row.get("pm_parent_member_id")?,
child_member_count: row.get("pm_child_member_count")?,
member_game_setting,
member_settlement_setting,
bank_account: member_bank_account,
last_signined_ip: row.get("pm_last_signined_ip")?,
last_signined_at: row.get("pm_last_signined_at")?,
created_at: row.get("pm_created_at")?,
updated_at: row.get("pm_updated_at")?,
deleted_at: row.get("pm_deleted_at")?,
})
}
None => None, None => None,
}; };
let bank = match row let site = _Site {
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("_b_id")? id: row.get("m_s_id")?,
{ url: row.get("m_s_url")?,
Some(_) => Some(_Bank { name: row.get("m_s_name")?,
id: row.get("_b_id")?, path: row.get("m_s_path")?,
name: row.get("_b_name")?, show: row.get("m_s_show")?,
sort_order: row.get("_b_sort_order")?, can_use: row.get("m_s_can_use")?,
show: row.get("_b_show")?, memo: row.get("m_s_memo")?,
can_use: row.get("_b_can_use")?, expires_at: row.get("m_s_expires_at")?,
memo: row.get("_b_memo")?, created_at: row.get("m_s_created_at")?,
created_at: row.get("_b_created_at")?, updated_at: row.get("m_s_updated_at")?,
updated_at: row.get("_b_updated_at")?,
}),
None => None,
}; };
let member_bank_account = match bank { let member_class = _MemberClass {
Some(bank) => Some(MemberBankAccountModel { id: row.get("m_mc_id")?,
id: row.get("mba_id")?, parent_id: row.get("m_mc_parent_id")?,
member_id: row.get("mba_member_id")?, name: row.get("m_mc_name")?,
bank, show: row.get("m_mc_show")?,
name: row.get("mba_name")?, created_at: row.get("m_mc_created_at")?,
account_number: row.get("mba_account_number")?, updated_at: row.get("m_mc_updated_at")?,
exchange_password: row.get("mba_exchange_password")?, };
memo: row.get("mba_memo")?,
created_at: row.get("mba_created_at")?, let member_level = _MemberLevel {
updated_at: row.get("mba_updated_at")?, id: row.get("m_ml_id")?,
}), name: row.get("m_ml_name")?,
None => None, show: row.get("m_ml_show")?,
sort_order: row.get("m_ml_sort_order")?,
created_at: row.get("m_ml_created_at")?,
updated_at: row.get("m_ml_updated_at")?,
}; };
let member_game_setting = match row let member_game_setting = match row
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mgs_id")? .get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("m_mgs_id")?
{ {
Some(_) => Some(_MemberGameSetting { Some(_) => Some(_MemberGameSetting {
id: row.get("mgs_id")?, id: row.get("m_mgs_id")?,
member_id: row.get("mgs_member_id")?, member_id: row.get("m_mgs_member_id")?,
can_bet_casino: row.get("mgs_can_bet_casino")?, can_bet_casino: row.get("m_mgs_can_bet_casino")?,
can_bet_slot: row.get("mgs_can_bet_slot")?, can_bet_slot: row.get("m_mgs_can_bet_slot")?,
can_bet_powerball: row.get("mgs_can_bet_powerball")?, can_bet_powerball: row.get("m_mgs_can_bet_powerball")?,
can_bet_powerladder: row.get("mgs_can_bet_powerladder")?, can_bet_powerladder: row.get("m_mgs_can_bet_powerladder")?,
can_bet_eos: row.get("mgs_can_bet_eos")?, can_bet_eos: row.get("m_mgs_can_bet_eos")?,
can_bet_bogglepowerball: row.get("mgs_can_bet_bogglepowerball")?, can_bet_bogglepowerball: row.get("m_mgs_can_bet_bogglepowerball")?,
created_at: row.get("mgs_created_at")?, created_at: row.get("m_mgs_created_at")?,
updated_at: row.get("mgs_updated_at")?, updated_at: row.get("m_mgs_updated_at")?,
}), }),
None => None, None => None,
}; };
let member_settlement_setting = match row let member_settlement_setting = match row
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("mss_id")? .get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("m_mss_id")?
{ {
Some(_) => Some(_MemberSettlementSetting { Some(_) => Some(_MemberSettlementSetting {
id: row.get("mss_id")?, id: row.get("m_mss_id")?,
member_id: row.get("mss_member_id")?, member_id: row.get("m_mss_member_id")?,
can_exchange: row.get("mss_can_exchange")?, can_exchange: row.get("m_mss_can_exchange")?,
can_first_charge_comp: row.get("mss_can_first_charge_comp")?, can_first_charge_comp: row.get("m_mss_can_first_charge_comp")?,
can_per_charge_comp: row.get("mss_can_per_charge_comp")?, can_per_charge_comp: row.get("m_mss_can_per_charge_comp")?,
manual_payment_type_for_partner: row.get("mss_manual_payment_type_for_partner")?, manual_payment_type_for_partner: row.get("m_mss_manual_payment_type_for_partner")?,
settlement_type: row.get("mss_settlement_type")?, settlement_type: row.get("m_mss_settlement_type")?,
rate_casino: row.get("mss_rate_casino")?, rate_casino: row.get("m_mss_rate_casino")?,
rate_casino_loosing: row.get("mss_rate_casino_loosing")?, rate_casino_loosing: row.get("m_mss_rate_casino_loosing")?,
rate_casino_bacara: row.get("mss_rate_casino_bacara")?, rate_casino_bacara: row.get("m_mss_rate_casino_bacara")?,
rate_casino_roulette: row.get("mss_rate_casino_roulette")?, rate_casino_roulette: row.get("m_mss_rate_casino_roulette")?,
rate_casino_dragon_tiger: row.get("mss_rate_casino_dragon_tiger")?, rate_casino_dragon_tiger: row.get("m_mss_rate_casino_dragon_tiger")?,
rate_slot: row.get("mss_rate_slot")?, rate_slot: row.get("m_mss_rate_slot")?,
rate_slot_loosing: row.get("mss_rate_slot_loosing")?, rate_slot_loosing: row.get("m_mss_rate_slot_loosing")?,
rate_powerball_single: row.get("mss_rate_powerball_single")?, rate_powerball_single: row.get("m_mss_rate_powerball_single")?,
rate_powerball_combo: row.get("mss_rate_powerball_combo")?, rate_powerball_combo: row.get("m_mss_rate_powerball_combo")?,
rate_powerladder_single: row.get("mss_rate_powerladder_single")?, rate_powerladder_single: row.get("m_mss_rate_powerladder_single")?,
rate_powerladder_combo: row.get("mss_rate_powerladder_combo")?, rate_powerladder_combo: row.get("m_mss_rate_powerladder_combo")?,
rate_eos_single: row.get("mss_rate_eos_single")?, rate_eos_single: row.get("m_mss_rate_eos_single")?,
rate_eos_combo: row.get("mss_rate_eos_combo")?, rate_eos_combo: row.get("m_mss_rate_eos_combo")?,
rate_bogglepowerball_single: row.get("mss_rate_bogglepowerball_single")?, rate_bogglepowerball_single: row.get("m_mss_rate_bogglepowerball_single")?,
rate_bogglepowerball_combo: row.get("mss_rate_bogglepowerball_combo")?, rate_bogglepowerball_combo: row.get("m_mss_rate_bogglepowerball_combo")?,
created_at: row.get("mss_created_at")?, created_at: row.get("m_mss_created_at")?,
updated_at: row.get("mss_updated_at")?, updated_at: row.get("m_mss_updated_at")?,
}), }),
None => None, None => None,
}; };
let member_bank_account = match row
.get::<diesel::sql_types::Nullable<diesel::sql_types::Uuid>, Option<uuid::Uuid>>("m_mba_id")?
{
Some(_) => {
let bank = _Bank {
id: row.get("m_mba_b_id")?,
name: row.get("m_mba_b_name")?,
sort_order: row.get("m_mba_b_sort_order")?,
show: row.get("m_mba_b_show")?,
can_use: row.get("m_mba_b_can_use")?,
memo: row.get("m_mba_b_memo")?,
created_at: row.get("m_mba_b_created_at")?,
updated_at: row.get("m_mba_b_updated_at")?,
};
Some(MemberBankAccountModel {
id: row.get("m_mba_id")?,
member_id: row.get("m_mba_member_id")?,
bank,
name: row.get("m_mba_name")?,
account_number: row.get("m_mba_account_number")?,
exchange_password: row.get("m_mba_exchange_password")?,
memo: row.get("m_mba_memo")?,
created_at: row.get("m_mba_created_at")?,
updated_at: row.get("m_mba_updated_at")?,
})
}
None => None,
};
Ok(MemberModel { Ok(MemberModel {
id: row.get("m_id")?, id: row.get("m_id")?,
site: _Site { site,
id: row.get("s_id")?, member_class,
url: row.get("s_url")?, member_level,
name: row.get("s_name")?,
path: row.get("s_path")?,
show: row.get("s_show")?,
can_use: row.get("s_can_use")?,
memo: row.get("s_memo")?,
expires_at: row.get("s_expires_at")?,
created_at: row.get("s_created_at")?,
updated_at: row.get("s_updated_at")?,
},
member_class: _MemberClass {
id: row.get("mc_id")?,
parent_id: row.get("mc_parent_id")?,
name: row.get("mc_name")?,
show: row.get("mc_show")?,
created_at: row.get("mc_created_at")?,
updated_at: row.get("mc_updated_at")?,
},
member_level: _MemberLevel {
id: row.get("ml_id")?,
name: row.get("ml_name")?,
show: row.get("ml_show")?,
sort_order: row.get("ml_sort_order")?,
created_at: row.get("ml_created_at")?,
updated_at: row.get("ml_updated_at")?,
},
username: row.get("m_username")?, username: row.get("m_username")?,
password: row.get("m_password")?, password: row.get("m_password")?,
nickname: row.get("m_nickname")?, nickname: row.get("m_nickname")?,
mobile_phone_number: row.get("m_mobile_phone_number")?, mobile_phone_number: row.get("m_mobile_phone_number")?,
state: row.get("m_state")?, state: row.get("m_state")?,
state_changed_at: row.get("m_state_changed_at")?, state_changed_at: row.get("m_state_changed_at")?,
bank_account: member_bank_account,
member_game_setting, member_game_setting,
member_settlement_setting, member_settlement_setting,
bank_account: member_bank_account,
parent_member, parent_member,
child_member_count: row.get("m_child_member_count")?, child_member_count: row.get("m_child_member_count")?,
last_signined_ip: row.get("m_last_signined_ip")?, last_signined_ip: row.get("m_last_signined_ip")?,

View File

@ -51,9 +51,11 @@ impl From<&repositories::member::models::Member> for bpr::models::member::Member
} }
} }
impl From<&compositions::member::models::MemberModel> for bpr::models::member::MemberModel { impl From<&compositions::member::models::ParentMemberModel>
fn from(d: &compositions::member::models::MemberModel) -> Self { for bpr::models::member::ParentMemberModel
bpr::models::member::MemberModel { {
fn from(d: &compositions::member::models::ParentMemberModel) -> Self {
bpr::models::member::ParentMemberModel {
id: d.id.to_string(), id: d.id.to_string(),
site: Some(bpr::models::site::Site::from(&d.site)), site: Some(bpr::models::site::Site::from(&d.site)),
member_class: Some(bpr::models::member_class::MemberClass::from( member_class: Some(bpr::models::member_class::MemberClass::from(
@ -66,10 +68,49 @@ impl From<&compositions::member::models::MemberModel> for bpr::models::member::M
.bank_account .bank_account
.as_ref() .as_ref()
.map(bpr::models::member_bank_account::MemberBankAccountModel::from), .map(bpr::models::member_bank_account::MemberBankAccountModel::from),
parent_member: d parent_member_id: d.parent_member_id.map(|v| v.to_string()),
.parent_member child_member_count: d.child_member_count as u64,
.as_ref() username: d.username.clone(),
.map(bpr::models::member::Member::from), nickname: d.nickname.clone(),
mobile_phone_number: d.mobile_phone_number.clone(),
state: d.state as i32,
state_changed_at: d.state_changed_at.map(|d| d as u64),
member_game_setting: d
.member_game_setting
.as_ref()
.map(bpr::models::member_game_setting::MemberGameSetting::from),
member_settlement_setting: d
.member_settlement_setting
.as_ref()
.map(bpr::models::member_settlement_setting::MemberSettlementSetting::from),
last_signined_ip: d.last_signined_ip.clone(),
last_signined_at: d.last_signined_at.map(|d| d as u64),
created_at: d.created_at as u64,
updated_at: d.updated_at as u64,
deleted_at: d.deleted_at.map(|d| d as u64),
}
}
}
impl From<&compositions::member::models::MemberModel> for bpr::models::member::MemberModel {
fn from(d: &compositions::member::models::MemberModel) -> Self {
bpr::models::member::MemberModel {
id: d.id.to_string(),
site: Some(bpr::models::site::Site::from(&d.site)),
member_class: Some(bpr::models::member_class::MemberClass::from(
&d.member_class,
)),
member_level: Some(bpr::models::member_level::MemberLevel::from(
&d.member_level,
)),
bank_account: d
.bank_account
.as_ref()
.map(bpr::models::member_bank_account::MemberBankAccountModel::from),
parent_member: d
.parent_member
.as_ref()
.map(bpr::models::member::ParentMemberModel::from),
child_member_count: d.child_member_count as u64, child_member_count: d.child_member_count as u64,
username: d.username.clone(), username: d.username.clone(),
nickname: d.nickname.clone(), nickname: d.nickname.clone(),