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

Refactor project

This commit is contained in:
Pierre HUBERT 2021-02-13 16:15:25 +01:00
parent 972641c605
commit 17db8a7198
27 changed files with 29 additions and 29 deletions

View File

@ -8,13 +8,13 @@ use crate::api_data::res_check_security_answers::ResCheckSecurityAnswers;
use crate::api_data::res_check_security_questions_exists::ResCheckSecurityQuestionsExists; use crate::api_data::res_check_security_questions_exists::ResCheckSecurityQuestionsExists;
use crate::api_data::res_get_security_questions::ResGetSecurityQuestions; use crate::api_data::res_get_security_questions::ResGetSecurityQuestions;
use crate::constants::PASSWORD_RESET_TOKEN_LENGTH; use crate::constants::PASSWORD_RESET_TOKEN_LENGTH;
use crate::controllers::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::new_account::NewAccount; use crate::data::new_account::NewAccount;
use crate::data::user::{User, UserID}; use crate::data::user::{User, UserID};
use crate::helpers::{account_helper, user_helper}; use crate::helpers::{account_helper, user_helper};
use crate::routes::RequestResult;
/// Account controller /// Account controller
/// ///

View File

@ -13,7 +13,7 @@ use crate::api_data::joined_call_message::JoinedCallMessage;
use crate::api_data::left_call_message::LeftCallMessage; use crate::api_data::left_call_message::LeftCallMessage;
use crate::api_data::new_call_signal::NewCallSignalAPI; use crate::api_data::new_call_signal::NewCallSignalAPI;
use crate::api_data::user_calls_config::UserCallsConfig; use crate::api_data::user_calls_config::UserCallsConfig;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::controllers::user_ws_controller; use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::call_signal::{CallSignal, CloseCallStream, IceCandidate, NewUserCallSignal, SdpType, UserCallOfferRequest}; use crate::data::call_signal::{CallSignal, CloseCallStream, IceCandidate, NewUserCallSignal, SdpType, UserCallOfferRequest};

View File

@ -5,7 +5,7 @@
use crate::api_data::comment_api::CommentAPI; use crate::api_data::comment_api::CommentAPI;
use crate::api_data::res_create_comment::ResCreateComment; use crate::api_data::res_create_comment::ResCreateComment;
use crate::constants::PATH_COMMENTS_IMAGES; use crate::constants::PATH_COMMENTS_IMAGES;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::controllers::user_ws_controller; use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::comment::Comment; use crate::data::comment::Comment;

View File

@ -11,7 +11,7 @@ use crate::api_data::list_unread_conversations_api::UnreadConversationAPI;
use crate::api_data::res_count_unread_conversations::ResultCountUnreadConversations; use crate::api_data::res_count_unread_conversations::ResultCountUnreadConversations;
use crate::api_data::res_create_conversation::ResCreateConversation; use crate::api_data::res_create_conversation::ResCreateConversation;
use crate::api_data::res_find_private_conversations::ResFindPrivateConversations; use crate::api_data::res_find_private_conversations::ResFindPrivateConversations;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::controllers::user_ws_controller; use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::Res; use crate::data::error::Res;

View File

@ -4,7 +4,7 @@
use crate::api_data::friend_api::FriendAPI; use crate::api_data::friend_api::FriendAPI;
use crate::api_data::friendship_status_api::FriendshipStatusAPI; use crate::api_data::friendship_status_api::FriendshipStatusAPI;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::notification::NotifEventType; use crate::data::notification::NotifEventType;

View File

@ -10,7 +10,7 @@ use crate::api_data::group_member_api::GroupMemberAPI;
use crate::api_data::res_change_group_logo::ResChangeGroupLogo; use crate::api_data::res_change_group_logo::ResChangeGroupLogo;
use crate::api_data::res_create_group::GroupCreationResult; use crate::api_data::res_create_group::GroupCreationResult;
use crate::constants::{DEFAULT_GROUP_LOGO, PATH_GROUPS_LOGOS}; use crate::constants::{DEFAULT_GROUP_LOGO, PATH_GROUPS_LOGOS};
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel}; use crate::data::group::{Group, GroupAccessLevel, GroupPostsCreationLevel, GroupRegistrationLevel, GroupVisibilityLevel};
use crate::data::group_id::GroupID; use crate::data::group_id::GroupID;

View File

@ -2,7 +2,7 @@
//! //!
//! @author Pierre Hubert //! @author Pierre Hubert
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::ExecError; use crate::data::error::ExecError;
use crate::data::group::GroupAccessLevel; use crate::data::group::GroupAccessLevel;

View File

@ -1,5 +1,3 @@
pub mod routes;
pub mod server;
pub mod server_controller; pub mod server_controller;
pub mod user_ws_controller; pub mod user_ws_controller;
@ -19,5 +17,4 @@ pub mod notifications_controller;
pub mod virtual_directory_controller; pub mod virtual_directory_controller;
pub mod web_app_controller; pub mod web_app_controller;
pub mod calls_controller; pub mod calls_controller;
pub mod user_ws_routes;
pub mod user_ws_actions; pub mod user_ws_actions;

View File

@ -5,7 +5,7 @@
use crate::api_data::notification_api::NotificationAPI; use crate::api_data::notification_api::NotificationAPI;
use crate::api_data::res_count_all_unreads::ResCountAllUnread; use crate::api_data::res_count_all_unreads::ResCountAllUnread;
use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotifications; use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotifications;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::controllers::user_ws_controller; use crate::controllers::user_ws_controller;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::{Res, ResultBoxError}; use crate::data::error::{Res, ResultBoxError};

View File

@ -6,7 +6,7 @@ use crate::api_data::post_api::PostAPI;
use crate::api_data::posts_targets_api::PostsTargets; use crate::api_data::posts_targets_api::PostsTargets;
use crate::api_data::res_create_post::ResCreatePost; use crate::api_data::res_create_post::ResCreatePost;
use crate::constants::{PATH_POST_IMAGES, PATH_POST_PDF}; use crate::constants::{PATH_POST_IMAGES, PATH_POST_PDF};
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::{ExecError, ResultBoxError}; use crate::data::error::{ExecError, ResultBoxError};
use crate::data::group::GroupAccessLevel; use crate::data::group::GroupAccessLevel;

View File

@ -3,7 +3,7 @@
//! @author Pierre Hubert //! @author Pierre Hubert
use crate::api_data::global_search_result_api::GlobalSearchResultAPI; use crate::api_data::global_search_result_api::GlobalSearchResultAPI;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::global_search_result::GlobalSearchResult; use crate::data::global_search_result::GlobalSearchResult;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;

View File

@ -1,6 +1,6 @@
use crate::controllers::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::routes::RequestResult;
/// Main server controller /// Main server controller
/// ///

View File

@ -8,7 +8,7 @@ use crate::api_data::language_settings_api::LanguageSettingsAPI;
use crate::api_data::res_create_custom_emoji::ResCreateCustomEmoji; use crate::api_data::res_create_custom_emoji::ResCreateCustomEmoji;
use crate::api_data::security_settings_api::SecuritySettingsAPI; use crate::api_data::security_settings_api::SecuritySettingsAPI;
use crate::constants::SUPPORTED_LANGUAGES; use crate::constants::SUPPORTED_LANGUAGES;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::general_settings::GeneralSettings; use crate::data::general_settings::GeneralSettings;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;

View File

@ -4,7 +4,7 @@
use crate::api_data::survey_api::SurveyAPI; use crate::api_data::survey_api::SurveyAPI;
use crate::constants::MAXIMUM_NUMBER_SURVEY_CHOICES; use crate::constants::MAXIMUM_NUMBER_SURVEY_CHOICES;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;

View File

@ -7,7 +7,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use crate::api_data::user_info::APIUserInfo; use crate::api_data::user_info::APIUserInfo;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::user::UserID; use crate::data::user::UserID;

View File

@ -14,7 +14,6 @@ use serde_json::Value;
use crate::api_data::res_get_ws_token::ResGetWsToken; use crate::api_data::res_get_ws_token::ResGetWsToken;
use crate::constants::{USER_LAST_ACTIVITY_REFRESH, WS_ACCESS_TOKEN_LENGTH}; use crate::constants::{USER_LAST_ACTIVITY_REFRESH, WS_ACCESS_TOKEN_LENGTH};
use crate::controllers::user_ws_controller::ws_connections_list::{add_connection, find_connection, get_ws_connections_list, remove_connection}; use crate::controllers::user_ws_controller::ws_connections_list::{add_connection, find_connection, get_ws_connections_list, remove_connection};
use crate::controllers::user_ws_routes::find_user_ws_route;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::config::conf; use crate::data::config::conf;
use crate::data::error::{ExecError, Res, ResultBoxError}; use crate::data::error::{ExecError, Res, ResultBoxError};
@ -26,6 +25,7 @@ use crate::data::user_ws_message::UserWsMessage;
use crate::data::user_ws_request_handler::{UserWsRequestHandler, UserWsResponseType}; use crate::data::user_ws_request_handler::{UserWsRequestHandler, UserWsResponseType};
use crate::helpers::{account_helper, events_helper}; use crate::helpers::{account_helper, events_helper};
use crate::helpers::events_helper::Event; use crate::helpers::events_helper::Event;
use crate::user_ws_routes::find_user_ws_route;
use crate::utils::crypt_utils::rand_str; use crate::utils::crypt_utils::rand_str;
use crate::utils::date_utils::time; use crate::utils::date_utils::time;

View File

@ -4,7 +4,7 @@
use crate::api_data::res_find_user_by_virtual_directory::FindUserByVirtualDirectoryAPIResult; use crate::api_data::res_find_user_by_virtual_directory::FindUserByVirtualDirectoryAPIResult;
use crate::api_data::res_find_virtual_directory::ResultFindVirtualDirectory; use crate::api_data::res_find_virtual_directory::ResultFindVirtualDirectory;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::helpers::{groups_helper, user_helper}; use crate::helpers::{groups_helper, user_helper};

View File

@ -3,10 +3,10 @@
//! @author Pierre Hubert //! @author Pierre Hubert
use crate::api_data::user_membership_api::UserMembershipAPI; use crate::api_data::user_membership_api::UserMembershipAPI;
use crate::controllers::routes::RequestResult;
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::helpers::webapp_helper; use crate::helpers::webapp_helper;
use crate::routes::RequestResult;
/// Get the list of memberships of a given user /// Get the list of memberships of a given user
pub fn get_memberships(r: &mut HttpRequestHandler) -> RequestResult { pub fn get_memberships(r: &mut HttpRequestHandler) -> RequestResult {

View File

@ -11,7 +11,6 @@ use serde::Serialize;
use crate::api_data::http_error::HttpError; use crate::api_data::http_error::HttpError;
use crate::constants::PASSWORD_MIN_LENGTH; use crate::constants::PASSWORD_MIN_LENGTH;
use crate::controllers::routes::RequestResult;
use crate::data::comment::Comment; use crate::data::comment::Comment;
use crate::data::conversation::ConvID; use crate::data::conversation::ConvID;
use crate::data::custom_emoji::CustomEmoji; use crate::data::custom_emoji::CustomEmoji;
@ -23,6 +22,7 @@ use crate::data::user::UserID;
use crate::data::user_token::UserAccessToken; use crate::data::user_token::UserAccessToken;
use crate::helpers::{account_helper, comments_helper, conversations_helper, custom_emojies_helper, friends_helper, groups_helper, posts_helper, user_helper, virtual_directory_helper}; use crate::helpers::{account_helper, comments_helper, conversations_helper, custom_emojies_helper, friends_helper, groups_helper, posts_helper, user_helper, virtual_directory_helper};
use crate::helpers::virtual_directory_helper::VirtualDirType; use crate::helpers::virtual_directory_helper::VirtualDirType;
use crate::routes::RequestResult;
use crate::utils::pdf_utils::is_valid_pdf; use crate::utils::pdf_utils::is_valid_pdf;
use crate::utils::string_utils::{check_emoji_code, check_string_before_insert, check_url, remove_html_nodes}; use crate::utils::string_utils::{check_emoji_code, check_string_before_insert, check_url, remove_html_nodes};
use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path}; use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path};

View File

@ -7,7 +7,7 @@ use actix_web::http::{HeaderName, HeaderValue, StatusCode};
use serde::Serialize; use serde::Serialize;
use crate::api_data::http_error::HttpError; use crate::api_data::http_error::HttpError;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::api_client::APIClient; use crate::data::api_client::APIClient;
use crate::data::base_request_handler::{BaseRequestHandler, RequestValue}; use crate::data::base_request_handler::{BaseRequestHandler, RequestValue};
use crate::data::config::conf; use crate::data::config::conf;

View File

@ -5,7 +5,7 @@ use std::collections::HashMap;
use serde::Serialize; use serde::Serialize;
use crate::api_data::http_error::HttpError; use crate::api_data::http_error::HttpError;
use crate::controllers::routes::RequestResult; use crate::routes::RequestResult;
use crate::data::base_request_handler::{BaseRequestHandler, RequestValue}; use crate::data::base_request_handler::{BaseRequestHandler, RequestValue};
use crate::data::error::ResultBoxError; use crate::data::error::ResultBoxError;
use crate::data::user_token::UserAccessToken; use crate::data::user_token::UserAccessToken;

View File

@ -6,10 +6,10 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use crate::constants::LIMIT_COUNTER_LIFETIME; use crate::constants::LIMIT_COUNTER_LIFETIME;
use crate::controllers::routes::{LimitPolicy, Route};
use crate::data::base_request_handler::BaseRequestHandler; use crate::data::base_request_handler::BaseRequestHandler;
use crate::data::error::{ExecError, ResultBoxError}; use crate::data::error::{ExecError, ResultBoxError};
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::routes::{LimitPolicy, Route};
use crate::utils::date_utils; use crate::utils::date_utils;
use crate::utils::date_utils::time; use crate::utils::date_utils::time;

View File

@ -12,3 +12,6 @@ pub mod api_data;
pub mod utils; pub mod utils;
pub mod constants; pub mod constants;
pub mod server;
pub mod user_ws_routes;
pub mod routes;

View File

@ -1,6 +1,6 @@
use comunic_server::controllers::server;
use comunic_server::data::config::{conf, Config}; use comunic_server::data::config::{conf, Config};
use comunic_server::helpers::database; use comunic_server::helpers::database;
use comunic_server::server;
#[actix_rt::main] #[actix_rt::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {

View File

@ -1,8 +1,8 @@
use std::error::Error; use std::error::Error;
use crate::controllers::{account_controller, calls_controller, comments_controller, conversations_controller, friends_controller, groups_controller, likes_controller, notifications_controller, posts_controller, search_controller, server_controller, settings_controller, surveys_controller, user_controller, user_ws_controller, virtual_directory_controller, web_app_controller}; use crate::controllers::{account_controller, calls_controller, comments_controller, conversations_controller, friends_controller, groups_controller, likes_controller, notifications_controller, posts_controller, search_controller, server_controller, settings_controller, surveys_controller, user_controller, user_ws_controller, virtual_directory_controller, web_app_controller};
use crate::controllers::routes::Method::{GET, POST};
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;
use crate::routes::Method::{GET, POST};
/// Project routes /// Project routes
/// ///

View File

@ -15,8 +15,8 @@ use percent_encoding::percent_decode_str;
use crate::api_data::http_error::HttpError; use crate::api_data::http_error::HttpError;
use crate::constants::MAX_REQUEST_SIZE; use crate::constants::MAX_REQUEST_SIZE;
use crate::controllers::{rtc_relay_controller, user_ws_controller}; use crate::controllers::{rtc_relay_controller, user_ws_controller};
use crate::controllers::routes::{get_routes, RequestResult, Route}; use crate::routes::{get_routes, RequestResult, Route};
use crate::controllers::routes::Method::{GET, POST}; use crate::routes::Method::{GET, POST};
use crate::data::base_request_handler::{BaseRequestHandler, PostFile, RequestValue}; use crate::data::base_request_handler::{BaseRequestHandler, PostFile, RequestValue};
use crate::data::config::Config; use crate::data::config::Config;
use crate::data::http_request_handler::HttpRequestHandler; use crate::data::http_request_handler::HttpRequestHandler;