mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Add new configuration fields
This commit is contained in:
parent
8d88e28df6
commit
ff8a862221
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
Loading…
Reference in New Issue
Block a user