diff --git a/src/constants.rs b/src/constants.rs new file mode 100644 index 0000000..156aa8e --- /dev/null +++ b/src/constants.rs @@ -0,0 +1,17 @@ +//! Project constants +//! +//! This module contains all the hard-coded value that might be used everywhere in the project. +//! +//! @author Pierre Hubert + +/// The name of the tables +pub mod database_tables_names { + /// API services tokens table + pub const SERVICES_TABLES: &str = "comunic_api_services_tokens"; + + /// User access tokens table + pub const USER_ACCESS_TOKENS_TABLE: &str = "comunic_api_users_tokens"; + + /// User table + pub const USERS_TABLE: &str = "utilisateurs"; +} \ No newline at end of file diff --git a/src/database_structure.rs b/src/database_structure.rs deleted file mode 100644 index d7adcce..0000000 --- a/src/database_structure.rs +++ /dev/null @@ -1,12 +0,0 @@ -/// Database structure information -/// -/// @author Pierre Hubert - -/// API services tokens table -pub const SERVICES_TABLES : &str = "comunic_api_services_tokens"; - -/// User access tokens table -pub const USER_ACCESS_TOKENS_TABLE: &str = "comunic_api_users_tokens"; - -/// User table -pub const USERS_TABLE : &str = "utilisateurs"; \ No newline at end of file diff --git a/src/helpers/account_helper.rs b/src/helpers/account_helper.rs index 7861b7a..93b10b4 100644 --- a/src/helpers/account_helper.rs +++ b/src/helpers/account_helper.rs @@ -2,7 +2,7 @@ use crate::data::api_client::APIClient; use crate::data::error::{ExecError, ResultBoxError}; use crate::data::user::UserID; use crate::data::user_token::UserAccessToken; -use crate::database_structure::USER_ACCESS_TOKENS_TABLE; +use crate::constants::database_tables_names::USER_ACCESS_TOKENS_TABLE; use crate::helpers::{database, user_helper}; use crate::helpers::database::{QueryInfo, InsertQuery, DeleteQuery}; use crate::utils::crypt_utils::{crypt_pass, rand_str}; diff --git a/src/helpers/api_helper.rs b/src/helpers/api_helper.rs index 3da4c54..ba00713 100644 --- a/src/helpers/api_helper.rs +++ b/src/helpers/api_helper.rs @@ -1,7 +1,7 @@ use crate::data::api_client::APIClient; use crate::helpers::database; use crate::helpers::database::QueryInfo; -use crate::database_structure::SERVICES_TABLES; +use crate::constants::database_tables_names::SERVICES_TABLES; use crate::data::error::ResultBoxError; /// API helper diff --git a/src/helpers/user_helper.rs b/src/helpers/user_helper.rs index 49841bb..7ece49d 100644 --- a/src/helpers/user_helper.rs +++ b/src/helpers/user_helper.rs @@ -1,7 +1,7 @@ use crate::data::error::ResultBoxError; use crate::data::user::{User, UserID, UserPageStatus, AccountImageVisibility}; use crate::helpers::database; -use crate::database_structure::USERS_TABLE; +use crate::constants::database_tables_names::USERS_TABLE; /// User helper /// diff --git a/src/lib.rs b/src/lib.rs index b0092f8..9f16414 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,4 +4,4 @@ pub mod controllers; pub mod api_data; pub mod utils; -pub mod database_structure; \ No newline at end of file +pub mod constants; \ No newline at end of file