mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-29 16:56:28 +00:00
120 lines
3.9 KiB
Rust
120 lines
3.9 KiB
Rust
//! Project constants
|
|
//!
|
|
//! This module contains all the hard-coded value that might be used everywhere in the project.
|
|
//!
|
|
//! @author Pierre Hubert
|
|
|
|
use std::time::Duration;
|
|
|
|
/// The name of the tables
|
|
pub mod database_tables_names {
|
|
/// API services tokens table
|
|
pub const CLIENTS_TABLE: &str = "comunic_clients";
|
|
|
|
/// User access tokens table
|
|
pub const USER_ACCESS_TOKENS_TABLE: &str = "comunic_user_access_tokens";
|
|
|
|
/// User table
|
|
pub const USERS_TABLE: &str = "utilisateurs";
|
|
|
|
/// Friends table
|
|
pub const FRIENDS_TABLE: &str = "amis";
|
|
|
|
/// Custom emojis table
|
|
pub const EMOJIS_TABLE: &str = "comunic_custom_emojis";
|
|
|
|
/// Likes table
|
|
pub const LIKES_TABLE: &str = "aime";
|
|
|
|
/// Groups list table
|
|
pub const GROUPS_LIST_TABLE: &str = "comunic_groups";
|
|
|
|
/// Groups members table
|
|
pub const GROUPS_MEMBERS_TABLE: &str = "comunic_groups_members";
|
|
|
|
/// Conversations tables
|
|
pub const CONV_LIST_TABLE: &str = "comunic_conversations_list";
|
|
pub const CONV_USERS_TABLE: &str = "comunic_conversations_users";
|
|
pub const CONV_MESSAGES_TABLE: &str = "comunic_conversations_messages";
|
|
|
|
/// Posts table
|
|
pub const POSTS_TABLE: &str = "texte";
|
|
|
|
/// Movies table
|
|
pub const MOVIES_TABLE: &str = "galerie_video";
|
|
|
|
/// Survey info table
|
|
pub const SURVEY_INFO_TABLE: &str = "sondage";
|
|
|
|
/// Survey choices table
|
|
pub const SURVEY_CHOICES_TABLE: &str = "sondage_choix";
|
|
|
|
/// Survey responses table
|
|
pub const SURVEY_RESPONSE_TABLE: &str = "sondage_reponse";
|
|
|
|
/// Comments table
|
|
pub const COMMENTS_TABLE: &str = "commentaires";
|
|
|
|
/// Notifications table
|
|
pub const NOTIFICATIONS_TABLE: &str = "comunic_notifications";
|
|
}
|
|
|
|
/// WebSocket access token lifetime, in seconds
|
|
pub const WS_ACCESS_TOKEN_LIFETIME: u64 = 10;
|
|
|
|
/// WebSocket access token length
|
|
pub const WS_ACCESS_TOKEN_LENGTH: usize = 10;
|
|
|
|
/// Lifetime of limit counter (1 hour)
|
|
pub const LIMIT_COUNTER_LIFETIME: u64 = 60 * 60;
|
|
|
|
/// The account image to show for user who do not have any
|
|
pub const DEFAULT_ACCOUNT_IMAGE: &str = "avatars/0Reverse.png";
|
|
|
|
/// The account image to show for users who are not allowed to access other users account images
|
|
pub const ERROR_ACCOUNT_IMAGE: &str = "avatars/0Red.png";
|
|
|
|
/// The path where groups logos should be stored
|
|
pub const PATH_GROUPS_LOGOS: &str = "groups_logo";
|
|
|
|
/// The group logo to use when no custom logo have been uploaded
|
|
pub const DEFAULT_GROUP_LOGO: &str = "groups_logo/default.png";
|
|
|
|
/// The path where image associated with posts should be stored
|
|
pub const PATH_POST_IMAGES: &str = "imgpost";
|
|
|
|
/// The path were PDF included with posts should be stored
|
|
pub const PATH_POST_PDF: &str = "post_pdf";
|
|
|
|
/// The page where comments images are stored
|
|
pub const PATH_COMMENTS_IMAGES: &str = "imgcommentaire";
|
|
|
|
/// Maximum requests size (50 Mo)
|
|
pub const MAX_REQUEST_SIZE: usize = 50000000;
|
|
|
|
/// Maximum number of choices per survey
|
|
pub const MAXIMUM_NUMBER_SURVEY_CHOICES: usize = 20;
|
|
|
|
/// Length of password reset token
|
|
pub const PASSWORD_RESET_TOKEN_LENGTH: usize = 255;
|
|
|
|
/// Duration of the validity of a password reset token (6 hours)
|
|
pub const PASSWORD_RESET_TOKEN_LIFETIME: u64 = 60 * 60 * 6;
|
|
|
|
/// Minimum password length
|
|
pub const PASSWORD_MIN_LENGTH: usize = 3;
|
|
|
|
/// Supported languages (for ComunicWeb)
|
|
pub const SUPPORTED_LANGUAGES: &'static [&'static str] = &["en", "fr"];
|
|
|
|
/// Interval at which last active time of user should be recorded
|
|
pub const USER_LAST_ACTIVITY_REFRESH: Duration = Duration::from_secs(60);
|
|
|
|
/// Interval at which last activity of an access token should be recorded
|
|
pub const USER_ACCESS_TOKEN_ACTIVITY_REFRESH: Duration = Duration::from_secs(60 * 60);
|
|
|
|
/// Sleep time before initial clean up execution
|
|
pub const INITIAL_REFRESH_LOAD_INTERVAL: Duration = Duration::from_secs(5);
|
|
|
|
/// Interval between each cleanup operation (every hour)
|
|
pub const CLEAN_UP_INTERVAL: Duration = Duration::from_secs(60 * 60); |