1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-11-22 13:29:21 +00:00

database_structure => constants

This commit is contained in:
Pierre HUBERT 2020-05-26 17:51:11 +02:00
parent cca7f02f8e
commit 175266f397
6 changed files with 21 additions and 16 deletions

17
src/constants.rs Normal file
View File

@ -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";
}

View File

@ -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";

View File

@ -2,7 +2,7 @@ use crate::data::api_client::APIClient;
use crate::data::error::{ExecError, ResultBoxError}; use crate::data::error::{ExecError, ResultBoxError};
use crate::data::user::UserID; use crate::data::user::UserID;
use crate::data::user_token::UserAccessToken; 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, user_helper};
use crate::helpers::database::{QueryInfo, InsertQuery, DeleteQuery}; use crate::helpers::database::{QueryInfo, InsertQuery, DeleteQuery};
use crate::utils::crypt_utils::{crypt_pass, rand_str}; use crate::utils::crypt_utils::{crypt_pass, rand_str};

View File

@ -1,7 +1,7 @@
use crate::data::api_client::APIClient; use crate::data::api_client::APIClient;
use crate::helpers::database; use crate::helpers::database;
use crate::helpers::database::QueryInfo; use crate::helpers::database::QueryInfo;
use crate::database_structure::SERVICES_TABLES; use crate::constants::database_tables_names::SERVICES_TABLES;
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
/// API helper /// API helper

View File

@ -1,7 +1,7 @@
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
use crate::data::user::{User, UserID, UserPageStatus, AccountImageVisibility}; use crate::data::user::{User, UserID, UserPageStatus, AccountImageVisibility};
use crate::helpers::database; use crate::helpers::database;
use crate::database_structure::USERS_TABLE; use crate::constants::database_tables_names::USERS_TABLE;
/// User helper /// User helper
/// ///

View File

@ -4,4 +4,4 @@ pub mod controllers;
pub mod api_data; pub mod api_data;
pub mod utils; pub mod utils;
pub mod database_structure; pub mod constants;