diff --git a/.vscode/launch.json b/.vscode/launch.json index 21bbe1c..4ab2ea1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,7 +25,6 @@ "QUEUE_BROKER": "bet.beteran", "CAPTCHA_SALT": "!#%&(24680qetuWRYI", "PASSWORD_SALT": "@$^*)13579wryipQETUO", - "JWT_SECRET": "!@$^*)13579wryipQETUO!", }, "args": [], "cwd": "${workspaceFolder}" @@ -52,7 +51,6 @@ "QUEUE_BROKER": "bet.beteran", "CAPTCHA_SALT": "!#%&(24680qetuWRYI", "PASSWORD_SALT": "@$^*)13579wryipQETUO", - "JWT_SECRET": "!@$^*)13579wryipQETUO!", }, "args": [], "cwd": "${workspaceFolder}" diff --git a/Cargo.toml b/Cargo.toml index b39df25..b592455 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,6 @@ diesel-derive-enum = { version = "1", features = ["postgres"] } futures = { version = "0", default-features = false, features = [ "async-await", ] } -jsonwebtoken = { version = "8" } nats = { version = "0" } prost = { version = "0" } rust-argon2 = { version = "1" } @@ -38,7 +37,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.74-snapshot" } -beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.58-snapshot" } +beteran-protobuf-rust = { git = "https://gitlab.loafle.net/bet/beteran-protobuf-rust.git", tag = "v0.1.77-snapshot" } +beteran-common-rust = { git = "https://gitlab.loafle.net/bet/beteran-common-rust.git", tag = "v0.1.62-snapshot" } [build-dependencies] diff --git a/src/compositions/identity/composition.rs b/src/compositions/identity/composition.rs deleted file mode 100644 index 8ffa83e..0000000 --- a/src/compositions/identity/composition.rs +++ /dev/null @@ -1,55 +0,0 @@ -//! -//! - -use super::models; -use crate::repositories; -use time::{Duration, OffsetDateTime}; - -pub struct Composition { - jwt_secret: String, - site_repository: repositories::site::repository::Repository, -} - -impl std::fmt::Debug for Composition { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - f.debug_struct("Composition of members").finish() - } -} - -impl Composition { - /// - pub fn new(jwt_secret: String) -> Composition { - Composition { - jwt_secret, - site_repository: repositories::site::repository::Repository::new(), - } - } - - /// - pub fn get_token( - &self, - issuer: String, - session_id: String, - ) -> Result { - use jsonwebtoken::{encode, Algorithm, EncodingKey, Header}; - - let header = Header::new(Algorithm::HS512); - - let issued_at = OffsetDateTime::now_utc(); - let expiration_at = issued_at + Duration::days(1); - let claims = models::Claims { - iss: issuer, - iat: issued_at.unix_timestamp(), - exp: expiration_at.unix_timestamp(), - session_id, - }; - - let token = encode( - &header, - &claims, - &EncodingKey::from_secret(self.jwt_secret.as_bytes()), - )?; - - Ok(token) - } -} diff --git a/src/compositions/identity/mod.rs b/src/compositions/identity/mod.rs deleted file mode 100644 index e0b4e90..0000000 --- a/src/compositions/identity/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! -//! - -/// -pub mod composition; -/// -pub mod models; diff --git a/src/compositions/identity/models.rs b/src/compositions/identity/models.rs deleted file mode 100644 index a2444cb..0000000 --- a/src/compositions/identity/models.rs +++ /dev/null @@ -1,19 +0,0 @@ -use serde::{Deserialize, Serialize}; - -// #[derive(Debug, Serialize, Deserialize)] -// struct Claims { -// aud: String, // Optional. Audience -// exp: usize, // Required (validate_exp defaults to true in validation). Expiration time (as UTC timestamp) -// iat: usize, // Optional. Issued at (as UTC timestamp) -// iss: String, // Optional. Issuer -// nbf: usize, // Optional. Not Before (as UTC timestamp) -// sub: String, // Optional. Subject (whom token refers to) -// } - -#[derive(Debug, Serialize, Deserialize)] -pub struct Claims { - pub iss: String, - pub iat: i64, - pub exp: i64, - pub session_id: String, -} diff --git a/src/compositions/mod.rs b/src/compositions/mod.rs index 997a973..838e0a4 100644 --- a/src/compositions/mod.rs +++ b/src/compositions/mod.rs @@ -1,4 +1,3 @@ -pub mod identity; pub mod member; pub mod member_referrer; pub mod site; diff --git a/src/main.rs b/src/main.rs index 3640de8..31c9b6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,10 +43,6 @@ async fn main() -> Result<(), Box> { Some(v) => v.into_string().unwrap(), None => "".to_string(), }; - let jwt_secret = match env::var_os("JWT_SECRET") { - Some(v) => v.into_string().unwrap(), - None => "".to_string(), - }; let manager = ConnectionManager::::new(url_db); let pool = Pool::builder() @@ -71,7 +67,6 @@ async fn main() -> Result<(), Box> { pool.clone(), captcha_salt.clone(), password_salt.clone(), - jwt_secret.clone(), ); let member_service = services::member::service::Service::new( connection_server_broker.clone(), @@ -115,6 +110,11 @@ async fn main() -> Result<(), Box> { queue_server_broker.clone(), pool.clone(), ); + let member_session_service = services::member_session::service::Service::new( + connection_server_broker.clone(), + queue_server_broker.clone(), + pool.clone(), + ); let member_settlement_setting_service = services::member_settlement_setting::service::Service::new( connection_server_broker.clone(), @@ -145,6 +145,7 @@ async fn main() -> Result<(), Box> { member_class_service.subscribe(), member_game_setting_service.subscribe(), member_level_service.subscribe(), + member_session_service.subscribe(), member_referrer_service.subscribe(), member_settlement_setting_service.subscribe(), site_service.subscribe(), diff --git a/src/repositories/bank/models.rs b/src/repositories/bank/models.rs index 3cdee1b..fd8c52b 100644 --- a/src/repositories/bank/models.rs +++ b/src/repositories/bank/models.rs @@ -72,7 +72,7 @@ pub struct FindAllSearch { pub struct FindAll { pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/bank/repository.rs b/src/repositories/bank/repository.rs index bd21f10..3b33d68 100644 --- a/src/repositories/bank/repository.rs +++ b/src/repositories/bank/repository.rs @@ -114,7 +114,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(banks::name.asc()); } @@ -126,7 +126,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(banks::name.desc()); } diff --git a/src/repositories/member/models.rs b/src/repositories/member/models.rs index 4041fb0..b9f913d 100644 --- a/src/repositories/member/models.rs +++ b/src/repositories/member/models.rs @@ -142,7 +142,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member/repository.rs b/src/repositories/member/repository.rs index 33d6421..c41c49a 100644 --- a/src/repositories/member/repository.rs +++ b/src/repositories/member/repository.rs @@ -193,7 +193,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "username" => { q = q.order_by(dsl::username.asc()); } @@ -223,7 +223,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "username" => { q = q.order_by(dsl::username.desc()); } diff --git a/src/repositories/member_bank_account/models.rs b/src/repositories/member_bank_account/models.rs index fdc945e..25a3b63 100644 --- a/src/repositories/member_bank_account/models.rs +++ b/src/repositories/member_bank_account/models.rs @@ -86,7 +86,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_bank_account/repository.rs b/src/repositories/member_bank_account/repository.rs index 71ff778..517d2b8 100644 --- a/src/repositories/member_bank_account/repository.rs +++ b/src/repositories/member_bank_account/repository.rs @@ -144,7 +144,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(member_bank_accounts::name.asc()); } @@ -159,7 +159,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(member_bank_accounts::name.desc()); } diff --git a/src/repositories/member_bank_deposit/models.rs b/src/repositories/member_bank_deposit/models.rs index d7ee701..c05dd0a 100644 --- a/src/repositories/member_bank_deposit/models.rs +++ b/src/repositories/member_bank_deposit/models.rs @@ -80,7 +80,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_bank_deposit/repository.rs b/src/repositories/member_bank_deposit/repository.rs index fe84c13..fda35f2 100644 --- a/src/repositories/member_bank_deposit/repository.rs +++ b/src/repositories/member_bank_deposit/repository.rs @@ -124,7 +124,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(member_bank_deposits::name.asc()); } @@ -142,7 +142,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(member_bank_deposits::name.desc()); } diff --git a/src/repositories/member_bank_withdraw/models.rs b/src/repositories/member_bank_withdraw/models.rs index 5faeac7..e5e9d8d 100644 --- a/src/repositories/member_bank_withdraw/models.rs +++ b/src/repositories/member_bank_withdraw/models.rs @@ -102,7 +102,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_bank_withdraw/repository.rs b/src/repositories/member_bank_withdraw/repository.rs index ad04c48..b831f78 100644 --- a/src/repositories/member_bank_withdraw/repository.rs +++ b/src/repositories/member_bank_withdraw/repository.rs @@ -136,7 +136,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_bank_withdraws::member_id.asc()); } @@ -163,7 +163,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_bank_withdraws::member_id.desc()); } diff --git a/src/repositories/member_class/models.rs b/src/repositories/member_class/models.rs index db95122..8d3778a 100644 --- a/src/repositories/member_class/models.rs +++ b/src/repositories/member_class/models.rs @@ -58,7 +58,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_class/repository.rs b/src/repositories/member_class/repository.rs index 9109ae1..49cea35 100644 --- a/src/repositories/member_class/repository.rs +++ b/src/repositories/member_class/repository.rs @@ -105,7 +105,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(member_classes::name.asc()); } @@ -118,7 +118,7 @@ impl Repository { _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(member_classes::name.desc()); } diff --git a/src/repositories/member_game_setting/models.rs b/src/repositories/member_game_setting/models.rs index e677a22..3016741 100644 --- a/src/repositories/member_game_setting/models.rs +++ b/src/repositories/member_game_setting/models.rs @@ -86,7 +86,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_game_setting/repository.rs b/src/repositories/member_game_setting/repository.rs index af14c00..744b581 100644 --- a/src/repositories/member_game_setting/repository.rs +++ b/src/repositories/member_game_setting/repository.rs @@ -133,7 +133,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "created_at" => { q = q.order_by(member_game_settings::created_at.asc()); } @@ -142,7 +142,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "created_at" => { q = q.order_by(member_game_settings::created_at.desc()); } diff --git a/src/repositories/member_level/models.rs b/src/repositories/member_level/models.rs index 17299f4..7928011 100644 --- a/src/repositories/member_level/models.rs +++ b/src/repositories/member_level/models.rs @@ -58,7 +58,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_level/repository.rs b/src/repositories/member_level/repository.rs index eba96d8..2ba4e8a 100644 --- a/src/repositories/member_level/repository.rs +++ b/src/repositories/member_level/repository.rs @@ -105,7 +105,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(member_levels::name.asc()); } @@ -120,7 +120,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(member_levels::name.desc()); } diff --git a/src/repositories/member_permission/models.rs b/src/repositories/member_permission/models.rs index 21cd6ea..9dbac88 100644 --- a/src/repositories/member_permission/models.rs +++ b/src/repositories/member_permission/models.rs @@ -39,7 +39,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_permission/repository.rs b/src/repositories/member_permission/repository.rs index 2a6d288..fb54a54 100644 --- a/src/repositories/member_permission/repository.rs +++ b/src/repositories/member_permission/repository.rs @@ -125,7 +125,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "role_resource_action_id" => { q = q.order_by(member_permissions::role_resource_action_id.asc()); } @@ -137,7 +137,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "role_resource_action_id" => { q = q.order_by(member_permissions::role_resource_action_id.desc()); } diff --git a/src/repositories/member_referrer/models.rs b/src/repositories/member_referrer/models.rs index b46a3e6..65c29db 100644 --- a/src/repositories/member_referrer/models.rs +++ b/src/repositories/member_referrer/models.rs @@ -54,7 +54,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_referrer/repository.rs b/src/repositories/member_referrer/repository.rs index bf411f5..ee434fa 100644 --- a/src/repositories/member_referrer/repository.rs +++ b/src/repositories/member_referrer/repository.rs @@ -150,7 +150,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_referrers::member_id.asc()); } @@ -165,7 +165,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_referrers::member_id.desc()); } diff --git a/src/repositories/member_role/models.rs b/src/repositories/member_role/models.rs index 71c8eb7..824e951 100644 --- a/src/repositories/member_role/models.rs +++ b/src/repositories/member_role/models.rs @@ -39,7 +39,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_role/repository.rs b/src/repositories/member_role/repository.rs index a11e30a..678a8b7 100644 --- a/src/repositories/member_role/repository.rs +++ b/src/repositories/member_role/repository.rs @@ -121,7 +121,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "role_id" => { q = q.order_by(member_roles::role_id.asc()); } @@ -133,7 +133,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "role_id" => { q = q.order_by(member_roles::role_id.desc()); } diff --git a/src/repositories/member_session/models.rs b/src/repositories/member_session/models.rs index 99277f7..f3ec244 100644 --- a/src/repositories/member_session/models.rs +++ b/src/repositories/member_session/models.rs @@ -54,7 +54,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_session/repository.rs b/src/repositories/member_session/repository.rs index 3fb0ccc..79e3382 100644 --- a/src/repositories/member_session/repository.rs +++ b/src/repositories/member_session/repository.rs @@ -119,7 +119,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_sessions::member_id.asc()); } @@ -134,7 +134,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "member_id" => { q = q.order_by(member_sessions::member_id.desc()); } diff --git a/src/repositories/member_settlement_setting/models.rs b/src/repositories/member_settlement_setting/models.rs index 6d4253f..289b26c 100644 --- a/src/repositories/member_settlement_setting/models.rs +++ b/src/repositories/member_settlement_setting/models.rs @@ -170,7 +170,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/member_settlement_setting/repository.rs b/src/repositories/member_settlement_setting/repository.rs index 9ea5a7c..f2d0f83 100644 --- a/src/repositories/member_settlement_setting/repository.rs +++ b/src/repositories/member_settlement_setting/repository.rs @@ -133,7 +133,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "rate_casino" => { q = q.order_by(member_settlement_settings::rate_casino.asc()); } @@ -187,7 +187,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "rate_casino" => { q = q.order_by(member_settlement_settings::rate_casino.desc()); } diff --git a/src/repositories/resource/models.rs b/src/repositories/resource/models.rs index cbdc806..3d7c7e7 100644 --- a/src/repositories/resource/models.rs +++ b/src/repositories/resource/models.rs @@ -84,7 +84,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/resource/repository.rs b/src/repositories/resource/repository.rs index ffc787b..29ab254 100644 --- a/src/repositories/resource/repository.rs +++ b/src/repositories/resource/repository.rs @@ -123,7 +123,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(resources::name.asc()); } @@ -141,7 +141,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(resources::name.desc()); } diff --git a/src/repositories/resource_action/models.rs b/src/repositories/resource_action/models.rs index 1b7078a..2231e00 100644 --- a/src/repositories/resource_action/models.rs +++ b/src/repositories/resource_action/models.rs @@ -84,7 +84,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/resource_action/repository.rs b/src/repositories/resource_action/repository.rs index 9c14c68..c5f99a0 100644 --- a/src/repositories/resource_action/repository.rs +++ b/src/repositories/resource_action/repository.rs @@ -123,7 +123,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(resource_actions::name.asc()); } @@ -141,7 +141,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(resource_actions::name.desc()); } diff --git a/src/repositories/role/models.rs b/src/repositories/role/models.rs index 50f47dd..edeed18 100644 --- a/src/repositories/role/models.rs +++ b/src/repositories/role/models.rs @@ -84,7 +84,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/role/repository.rs b/src/repositories/role/repository.rs index 9169dc9..7af289f 100644 --- a/src/repositories/role/repository.rs +++ b/src/repositories/role/repository.rs @@ -123,7 +123,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "name" => { q = q.order_by(roles::name.asc()); } @@ -141,7 +141,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "name" => { q = q.order_by(roles::name.desc()); } diff --git a/src/repositories/role_resource_action/models.rs b/src/repositories/role_resource_action/models.rs index 95681f8..2fbe011 100644 --- a/src/repositories/role_resource_action/models.rs +++ b/src/repositories/role_resource_action/models.rs @@ -39,7 +39,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/role_resource_action/repository.rs b/src/repositories/role_resource_action/repository.rs index e55bb4a..6ddfa2b 100644 --- a/src/repositories/role_resource_action/repository.rs +++ b/src/repositories/role_resource_action/repository.rs @@ -126,7 +126,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "role_id" => { q = q.order_by(role_resource_actions::role_id.asc()); } @@ -138,7 +138,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "role_id" => { q = q.order_by(role_resource_actions::role_id.desc()); } diff --git a/src/repositories/site/models.rs b/src/repositories/site/models.rs index e57d862..f672006 100644 --- a/src/repositories/site/models.rs +++ b/src/repositories/site/models.rs @@ -90,7 +90,7 @@ pub struct FindAll { /// pub search: Option, /// - pub pagination: Option, + pub pagination: Option, /// - pub sorts: Option>, + pub sorts: Option>, } diff --git a/src/repositories/site/repository.rs b/src/repositories/site/repository.rs index 031b0a8..996aaaa 100644 --- a/src/repositories/site/repository.rs +++ b/src/repositories/site/repository.rs @@ -146,7 +146,7 @@ impl Repository { if let Some(orderbys) = &find_all.sorts { for s in orderbys { match s { - bcr::models::pagination::Sort::ASC(property) => match property.as_str() { + bcr::pagination::Sort::ASC(property) => match property.as_str() { "url" => { q = q.order_by(sites::url.asc()); } @@ -167,7 +167,7 @@ impl Repository { } _ => {} }, - bcr::models::pagination::Sort::DESC(property) => match property.as_str() { + bcr::pagination::Sort::DESC(property) => match property.as_str() { "url" => { q = q.order_by(sites::url.desc()); } diff --git a/src/services/bank/service.rs b/src/services/bank/service.rs index 58772f4..29311c7 100644 --- a/src/services/bank/service.rs +++ b/src/services/bank/service.rs @@ -283,12 +283,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/identity/service.rs b/src/services/identity/service.rs index 7237c78..83f461c 100644 --- a/src/services/identity/service.rs +++ b/src/services/identity/service.rs @@ -20,7 +20,6 @@ pub struct Service<'a> { member_session_repository: repositories::member_session::repository::Repository, site_repository: repositories::site::repository::Repository, site_composition: compositions::site::composition::Composition, - identity_composition: compositions::identity::composition::Composition, argon2_config: argon2::Config<'a>, captcha_salt: String, password_salt: String, @@ -41,7 +40,6 @@ impl Service<'_> { pool: Pool>, captcha_salt: String, password_salt: String, - jwt_secret: String, ) -> Service<'static> { Service { connection_broker, @@ -51,7 +49,6 @@ impl Service<'_> { member_session_repository: repositories::member_session::repository::Repository::new(), site_repository: repositories::site::repository::Repository::new(), site_composition: compositions::site::composition::Composition::new(), - identity_composition: compositions::identity::composition::Composition::new(jwt_secret), argon2_config: argon2::Config::default(), captcha_salt, password_salt, @@ -612,10 +609,8 @@ impl Service<'_> { }) })?; - let access_token = self - .identity_composition - .get_token("Beteran".to_string(), session.id.to_string()) - .map_err(|e| { + let access_token = + bcr::jwt::encode("Beteran", session.id.to_string().as_str()).map_err(|e| { bcr::error::rpc::Error::Server(bcr::error::rpc::Server { code: bpr::protobuf::rpc::Error::SERVER_00, message: format!("server {}", e), @@ -818,10 +813,8 @@ impl Service<'_> { }) })?; - let access_token = self - .identity_composition - .get_token("Beteran".to_string(), session.id.to_string()) - .map_err(|e| { + let access_token = + bcr::jwt::encode("Beteran", session.id.to_string().as_str()).map_err(|e| { bcr::error::rpc::Error::Server(bcr::error::rpc::Server { code: bpr::protobuf::rpc::Error::SERVER_00, message: format!("server {}", e), diff --git a/src/services/member/service.rs b/src/services/member/service.rs index 2b274ad..cf37244 100644 --- a/src/services/member/service.rs +++ b/src/services/member/service.rs @@ -737,12 +737,12 @@ impl Service<'_> { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), search, diff --git a/src/services/member_bank_account/service.rs b/src/services/member_bank_account/service.rs index 0528a05..1753250 100644 --- a/src/services/member_bank_account/service.rs +++ b/src/services/member_bank_account/service.rs @@ -369,12 +369,12 @@ impl Service<'_> { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_bank_deposit/service.rs b/src/services/member_bank_deposit/service.rs index 6dec91f..e1dbf07 100644 --- a/src/services/member_bank_deposit/service.rs +++ b/src/services/member_bank_deposit/service.rs @@ -332,12 +332,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_bank_withdraw/service.rs b/src/services/member_bank_withdraw/service.rs index dc4d655..388f7c4 100644 --- a/src/services/member_bank_withdraw/service.rs +++ b/src/services/member_bank_withdraw/service.rs @@ -335,12 +335,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_class/service.rs b/src/services/member_class/service.rs index 2032e78..760fa2c 100644 --- a/src/services/member_class/service.rs +++ b/src/services/member_class/service.rs @@ -299,12 +299,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_game_setting/service.rs b/src/services/member_game_setting/service.rs index be4fd07..af7699f 100644 --- a/src/services/member_game_setting/service.rs +++ b/src/services/member_game_setting/service.rs @@ -326,12 +326,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_level/service.rs b/src/services/member_level/service.rs index 0d192d4..768dc24 100644 --- a/src/services/member_level/service.rs +++ b/src/services/member_level/service.rs @@ -278,12 +278,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_referrer/service.rs b/src/services/member_referrer/service.rs index 5fdebbf..79d1fae 100644 --- a/src/services/member_referrer/service.rs +++ b/src/services/member_referrer/service.rs @@ -490,12 +490,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/member_session/mod.rs b/src/services/member_session/mod.rs new file mode 100644 index 0000000..b9e52db --- /dev/null +++ b/src/services/member_session/mod.rs @@ -0,0 +1,2 @@ +pub mod models; +pub mod service; diff --git a/src/services/member_session/models.rs b/src/services/member_session/models.rs new file mode 100644 index 0000000..cbce7c9 --- /dev/null +++ b/src/services/member_session/models.rs @@ -0,0 +1,17 @@ +use crate::repositories; +use beteran_protobuf_rust as bpr; + +impl From<&repositories::member_session::models::MemberSession> + for bpr::models::member_session::MemberSession +{ + fn from(d: &repositories::member_session::models::MemberSession) -> Self { + bpr::models::member_session::MemberSession { + id: d.id.to_string(), + member_id: d.member_id.to_string(), + ip: d.ip.clone(), + last_accessed_at: d.last_accessed_at as u64, + expires_at: d.expires_at as u64, + created_at: d.created_at as u64, + } + } +} diff --git a/src/services/member_session/service.rs b/src/services/member_session/service.rs new file mode 100644 index 0000000..cd3bf6b --- /dev/null +++ b/src/services/member_session/service.rs @@ -0,0 +1,423 @@ +//! +//! + +use std::str::FromStr; + +use super::models; +use crate::compositions; +use crate::repositories; +use beteran_common_rust as bcr; +use beteran_protobuf_rust as bpr; +use diesel::{ + r2d2::{ConnectionManager, Pool}, + PgConnection, +}; +use prost::Message; + +/// +pub struct Service { + connection_broker: nats::asynk::Connection, + queue_broker: String, + pool: Pool>, + site_composition: compositions::site::composition::Composition, + member_session_repository: repositories::member_session::repository::Repository, +} + +impl std::fmt::Debug for Service { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + f.debug_struct("Service of service.member.service.identity") + .finish() + } +} + +impl Service { + /// + pub fn new( + connection_broker: nats::asynk::Connection, + queue_broker: String, + pool: Pool>, + ) -> Service { + Service { + connection_broker, + queue_broker, + pool, + site_composition: compositions::site::composition::Composition::new(), + member_session_repository: repositories::member_session::repository::Repository::new(), + } + } + + pub async fn subscribe(&self) -> std::result::Result<(), std::boxed::Box> { + futures::try_join!( + self.get_member_session(), + self.get_member_session_with_renewal(), + ) + .map(|_| ()) + } + + fn check_site( + &self, + conn: &diesel::PgConnection, + url: Option, + site_id: uuid::Uuid, + ) -> Result { + match self + .site_composition + .select_by_url(conn, url, site_id) + .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, + }) + })? { + Some(s) => Ok(s), + None => Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid site_url information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.site_url".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::None, + message: "".to_string(), + }, + }, + )), + } + } + + async fn get_member_session(&self) -> Result<(), Box> { + let s = self + .connection_broker + .queue_subscribe( + bpr::ss::member_session::SUBJECT_GET_MEMBER_SESSION, + self.queue_broker.as_str(), + ) + .await?; + + while let Some(message) = s.next().await { + if let Err(e) = async { + let req = bpr::ss::member_session::GetMemberSessionRequest::decode(message.data.as_slice()) + .map_err(|e| { + bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest { + message: format!("invalid request: {}", e), + }) + })?; + let client = match req.client { + Some(c) => c, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid client information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + + let access_token = match client.access_token { + Some(at) => at, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid client.access_token information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + + let claims = bcr::jwt::decode(&access_token).map_err(|e| { + bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams { + message: "invalid client.access_token information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token".to_string(), + value: access_token.clone(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "invalid access_token".to_string(), + }, + }) + })?; + + let request = match req.request { + Some(r) => r, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid request information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "request".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + let id = uuid::Uuid::from_str(claims.session_id.as_str()).map_err(|e| { + bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams { + message: "invalid client.access_token.session_id param".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token.session_id".to_string(), + value: claims.session_id.clone(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: e.to_string(), + }, + }) + })?; + + let conn = self.pool.get().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 session = self + .member_session_repository + .select(&conn, id) + .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, + }) + })?; + + message + .respond( + bpr::ss::member_session::GetMemberSessionResponse { + error: None, + result: Some( + bpr::ss::member_session::get_member_session_response::Result { + member_session: session + .map(|d| bpr::models::member_session::MemberSession::from(&d)), + }, + ), + } + .encode_to_vec(), + ) + .await + .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, + }) + })?; + + Ok::<(), bcr::error::rpc::Error>(()) + } + .await + { + message + .respond( + bpr::ss::member_session::GetMemberSessionResponse { + error: Some(bpr::protobuf::rpc::Error::from(e)), + result: None, + } + .encode_to_vec(), + ) + .await?; + } + } + + Ok(()) + } + + async fn get_member_session_with_renewal(&self) -> Result<(), Box> { + let s = self + .connection_broker + .queue_subscribe( + bpr::ss::member_session::SUBJECT_GET_MEMBER_SESSION_WITH_RENEWAL, + self.queue_broker.as_str(), + ) + .await?; + + while let Some(message) = s.next().await { + if let Err(e) = async { + let req = bpr::ss::member_session::GetMemberSessionWithRenewalRequest::decode( + message.data.as_slice(), + ) + .map_err(|e| { + bcr::error::rpc::Error::InvalidRequest(bcr::error::rpc::InvalidRequest { + message: format!("invalid request: {}", e), + }) + })?; + let client = match req.client { + Some(c) => c, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid client information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + + let access_token = match client.access_token { + Some(at) => at, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid client.access_token information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + + let claims = bcr::jwt::decode(&access_token).map_err(|e| { + bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams { + message: "invalid client.access_token information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token".to_string(), + value: access_token.clone(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "invalid access_token".to_string(), + }, + }) + })?; + + let request = match req.request { + Some(r) => r, + None => { + return Err(bcr::error::rpc::Error::InvalidParams( + bcr::error::rpc::InvalidParams { + message: "invalid request information".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "request".to_string(), + value: "".to_string(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: "".to_string(), + }, + }, + )); + } + }; + let id = uuid::Uuid::from_str(claims.session_id.as_str()).map_err(|e| { + bcr::error::rpc::Error::InvalidParams(bcr::error::rpc::InvalidParams { + message: "invalid client.access_token.session_id param".to_string(), + detail: bcr::error::rpc::InvalidParamsDetail { + location: "request".to_string(), + param: "client.access_token.session_id".to_string(), + value: claims.session_id.clone(), + error_type: bcr::error::rpc::InvalidParamsType::Required, + message: e.to_string(), + }, + }) + })?; + + let conn = self.pool.get().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 last_accessed_at = (chrono::Utc::now()).timestamp(); + let expires_at = (chrono::Utc::now() + chrono::Duration::minutes(30)).timestamp(); + + self + .member_session_repository + .update_last_access( + &conn, + id, + &repositories::member_session::models::ModifyMemberSessionForLastAccess { + last_accessed_at, + expires_at, + }, + ) + .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 session = self + .member_session_repository + .select(&conn, id) + .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, + }) + })?; + + message + .respond( + bpr::ss::member_session::GetMemberSessionWithRenewalResponse { + error: None, + result: Some( + bpr::ss::member_session::get_member_session_with_renewal_response::Result { + member_session: session + .map(|d| bpr::models::member_session::MemberSession::from(&d)), + }, + ), + } + .encode_to_vec(), + ) + .await + .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, + }) + })?; + + Ok::<(), bcr::error::rpc::Error>(()) + } + .await + { + message + .respond( + bpr::ss::member_session::GetMemberSessionWithRenewalResponse { + error: Some(bpr::protobuf::rpc::Error::from(e)), + result: None, + } + .encode_to_vec(), + ) + .await?; + } + } + + Ok(()) + } +} diff --git a/src/services/member_settlement_setting/service.rs b/src/services/member_settlement_setting/service.rs index 4473af7..629cf4b 100644 --- a/src/services/member_settlement_setting/service.rs +++ b/src/services/member_settlement_setting/service.rs @@ -343,12 +343,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(bcr::models::pagination::Pagination::from), + .map(bcr::pagination::Pagination::from), sorts: Some( request .sorts .iter() - .map(beteran_common_rust::models::pagination::Sort::from) + .map(bcr::pagination::Sort::from) .collect(), ), }; diff --git a/src/services/mod.rs b/src/services/mod.rs index fcfad8b..09f3bfb 100644 --- a/src/services/mod.rs +++ b/src/services/mod.rs @@ -8,5 +8,6 @@ pub mod member_class; pub mod member_game_setting; pub mod member_level; pub mod member_referrer; +pub mod member_session; pub mod member_settlement_setting; pub mod site; diff --git a/src/services/site/service.rs b/src/services/site/service.rs index 8c7618f..859aba0 100644 --- a/src/services/site/service.rs +++ b/src/services/site/service.rs @@ -165,12 +165,12 @@ impl Service { pagination: request .pagination .as_ref() - .map(|d| bcr::models::pagination::Pagination::from(d)), + .map(|d| bcr::pagination::Pagination::from(d)), sorts: Some( request .sorts .iter() - .map(|d| beteran_common_rust::models::pagination::Sort::from(d)) + .map(|d| bcr::pagination::Sort::from(d)) .collect(), ), };