diff --git a/Cargo.toml b/Cargo.toml index a0c6497..70427d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,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.86-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.72-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.87-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.73-snapshot" } [build-dependencies] diff --git a/src/compositions/betting/models.rs b/src/compositions/betting/models.rs index cfdb9de..dbd0407 100644 --- a/src/compositions/betting/models.rs +++ b/src/compositions/betting/models.rs @@ -1,5 +1,4 @@ use beteran_common_rust as bcr; -use beteran_protobuf_rust as bpr; use diesel::deserialize::QueryableByName; /// @@ -8,8 +7,6 @@ pub struct BettingHistoryModel { /// pub id: String, /// - pub member: bpr::models::member::Member, - /// pub vendor_id: i64, /// pub vendor_name: String, @@ -53,45 +50,24 @@ pub struct BettingHistoryModel { pub created_at: i64, /// pub utc_created_at: i64, + /// + pub m_site_id: uuid::Uuid, + /// + pub m_member_class_id: uuid::Uuid, + /// + pub m_member_level_id: uuid::Uuid, + /// + pub m_parent_member_id: Option, + /// + pub m_nickname: String, + /// + pub m_mobile_phone_number: Option, } impl QueryableByName for BettingHistoryModel { fn build>(row: &R) -> diesel::deserialize::Result { - let member = bpr::models::member::Member { - id: row.get("_m_id")?, - site_id: row.get("_m_site_id")?, - member_class_id: row.get("_m_member_class_id")?, - member_level_id: row.get("_m_member_level_id")?, - username: row.get("_m_username")?, - nickname: row.get("_m_nickname")?, - mobile_phone_number: row.get("_m_mobile_phone_number")?, - state: row.get("_m_state")?, - state_changed_at: row - .get::, Option>( - "_m_state_changed_at", - )? - .map(|v| v as u64), - parent_member_id: row.get("_m_parent_member_id")?, - child_member_count: row.get::("_m_child_member_count")? - as u64, - last_signined_ip: row.get("_m_last_signined_ip")?, - last_signined_at: row - .get::, Option>( - "_m_last_signined_at", - )? - .map(|v| v as u64), - created_at: row.get::("_m_created_at")? as u64, - updated_at: row.get::("_m_updated_at")? as u64, - deleted_at: row - .get::, Option>( - "_m_deleted_at", - )? - .map(|v| v as u64), - }; - Ok(BettingHistoryModel { id: row.get("akbh_id")?, - member, vendor_id: row.get("akbh_vendor_id")?, vendor_name: row.get("akbh_vendor_name")?, game_id: row.get("akbh_game_id")?, @@ -114,6 +90,12 @@ impl QueryableByName for BettingHistoryModel { category: row.get("akbh_category")?, created_at: row.get("akbh_created_at")?, utc_created_at: row.get("akbh_utc_created_at")?, + m_site_id: row.get("_m_site_id")?, + m_member_class_id: row.get("_m_member_class_id")?, + m_member_level_id: row.get("_m_member_level_id")?, + m_nickname: row.get("_m_nickname")?, + m_mobile_phone_number: row.get("_m_mobile_phone_number")?, + m_parent_member_id: row.get("_m_parent_member_id")?, }) } } diff --git a/src/services/betting/models.rs b/src/services/betting/models.rs index 67902e3..de11d4d 100644 --- a/src/services/betting/models.rs +++ b/src/services/betting/models.rs @@ -5,28 +5,8 @@ impl From<&compositions::betting::models::BettingHistoryModel> for bpr::models::api::betting::BettingHistoryModel { fn from(d: &compositions::betting::models::BettingHistoryModel) -> Self { - let member = Some(bpr::models::member::Member { - id: d.member.id.to_string(), - site_id: d.member.site_id.to_string(), - member_class_id: d.member.member_class_id.to_string(), - member_level_id: d.member.member_level_id.to_string(), - parent_member_id: d.member.parent_member_id.as_ref().map(|d| d.to_string()), - child_member_count: d.member.child_member_count as u64, - username: d.member.username.clone(), - nickname: d.member.nickname.clone(), - mobile_phone_number: d.member.mobile_phone_number.clone(), - state: d.member.state as i32, - state_changed_at: d.member.state_changed_at.map(|d| d as u64), - last_signined_ip: d.member.last_signined_ip.clone(), - last_signined_at: d.member.last_signined_at.map(|d| d as u64), - created_at: d.member.created_at as u64, - updated_at: d.member.updated_at as u64, - deleted_at: d.member.deleted_at.map(|d| d as u64), - }); - bpr::models::api::betting::BettingHistoryModel { id: d.id.clone(), - member, vendor_id: d.vendor_id as u64, vendor_name: d.vendor_name.clone(), game_id: d.game_id as u64, @@ -49,6 +29,12 @@ impl From<&compositions::betting::models::BettingHistoryModel> category: d.category.clone(), created_at: d.created_at as u64, utc_created_at: d.utc_created_at as u64, + m_site_id: d.m_site_id.to_string(), + m_member_class_id: d.m_member_class_id.to_string(), + m_member_level_id: d.m_member_level_id.to_string(), + m_parent_member_id: d.m_parent_member_id.map(|v| v.to_string()), + m_nickname: d.m_nickname.clone(), + m_mobile_phone_number: d.m_mobile_phone_number.clone(), } } }