diff --git a/src/api_data/server_config.rs b/src/api_data/server_config.rs index 799974f..9210432 100644 --- a/src/api_data/server_config.rs +++ b/src/api_data/server_config.rs @@ -4,6 +4,7 @@ use serde::Serialize; use crate::constants::{conservation_policy, MIN_SUPPORTED_MOBILE_VERSION, password_policy}; +use crate::constants::accounts_info_policy::{MAX_FIRST_NAME_LENGTH, MAX_LAST_NAME_LENGTH, MIN_FIRST_NAME_LENGTH, MIN_LAST_NAME_LENGTH}; use crate::constants::conversations::{ALLOWED_CONVERSATION_FILES_TYPES, CONVERSATION_FILES_MAX_SIZE, CONVERSATION_WRITING_EVENT_INTERVAL, CONVERSATION_WRITING_EVENT_LIFETIME, MAX_CONV_IMAGE_MESSAGE_WIDTH, MAX_CONV_LOGO_HEIGHT, MAX_CONV_LOGO_WIDTH, MAX_CONV_MESSAGE_THUMBNAIL_HEIGHT, MAX_CONV_MESSAGE_THUMBNAIL_WIDTH, MAX_CONVERSATION_MESSAGE_LENGTH, MAX_CONVERSATION_NAME_LENGTH, MIN_CONVERSATION_MESSAGE_LENGTH}; use crate::data::api_client::APIClient; use crate::data::config::conf; @@ -53,6 +54,14 @@ struct ConversationsPolicy { max_logo_height: u32, } +#[derive(Serialize)] +struct AccountInformationPolicy { + min_first_name_length: u8, + max_first_name_length: u8, + min_last_name_length: u8, + max_last_name_length: u8, +} + #[derive(Serialize)] pub struct ServerConfig { min_supported_mobile_version: &'static str, @@ -65,6 +74,7 @@ pub struct ServerConfig { password_policy: PasswordPolicy, data_conservation_policy: DataConservationPolicy, conversations_policy: ConversationsPolicy, + account_info_policy: AccountInformationPolicy, } impl ServerConfig { @@ -116,6 +126,13 @@ impl ServerConfig { max_logo_width: MAX_CONV_LOGO_WIDTH, max_logo_height: MAX_CONV_LOGO_HEIGHT, }, + + account_info_policy: AccountInformationPolicy { + min_first_name_length: MIN_FIRST_NAME_LENGTH, + max_first_name_length: MAX_FIRST_NAME_LENGTH, + min_last_name_length: MIN_LAST_NAME_LENGTH, + max_last_name_length: MAX_LAST_NAME_LENGTH, + }, } } } diff --git a/src/constants.rs b/src/constants.rs index bd103fe..3e44f12 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -224,5 +224,16 @@ pub mod conversations { pub const MAX_CONV_LOGO_HEIGHT: u32 = 200; } +/// Account information policy +pub mod accounts_info_policy { + /// Minimum & maximum first name length + pub const MIN_FIRST_NAME_LENGTH: u8 = 2; + pub const MAX_FIRST_NAME_LENGTH: u8 = 50; + + /// Minimum & maximum last name length + pub const MIN_LAST_NAME_LENGTH: u8 = 2; + pub const MAX_LAST_NAME_LENGTH: u8 = 50; +} + /// Url where Firebase push notifications can be sent pub const FIREBASE_PUSH_MESSAGE_URL: &str = "https://fcm.googleapis.com/v1/projects/{PROJECT_ID}/messages:send"; \ No newline at end of file