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

Add legacy calls configuration

This commit is contained in:
Pierre HUBERT 2020-07-13 11:49:14 +02:00
parent 748fa64609
commit ee5f9bedc3
3 changed files with 24 additions and 79 deletions

View File

@ -0,0 +1,15 @@
//! # Calls controller
//!
//! @author Pierre Hubert
use std::collections::HashMap;
use crate::controllers::routes::RequestResult;
use crate::data::http_request_handler::HttpRequestHandler;
/// Get legacy call configuration
pub fn get_legacy_config(r: &mut HttpRequestHandler) -> RequestResult {
let mut map = HashMap::new();
map.insert("enabled", false);
r.set_response(map)
}

View File

@ -15,4 +15,5 @@ pub mod surveys_controller;
pub mod notifications_controller;
pub mod movies_controller;
pub mod virtual_directory_controller;
pub mod web_app_controller;
pub mod web_app_controller;
pub mod calls_controller;

View File

@ -1,13 +1,12 @@
use std::error::Error;
use crate::controllers::{account_controller, comments_controller, conversations_controller, friends_controller, groups_controller, likes_controller, movies_controller, notifications_controller, posts_controller, search_controller, server_controller, surveys_controller, user_controller, virtual_directory_controller, web_app_controller};
use crate::controllers::{account_controller, calls_controller, comments_controller, conversations_controller, friends_controller, groups_controller, likes_controller, movies_controller, notifications_controller, posts_controller, search_controller, server_controller, surveys_controller, user_controller, virtual_directory_controller, web_app_controller};
use crate::controllers::routes::Method::{GET, POST};
use crate::data::http_request_handler::HttpRequestHandler;
/// Project routes
///
/// @author Pierre Hubert
#[derive(PartialEq)]
pub enum Method {
GET,
@ -33,13 +32,12 @@ pub struct Route {
}
impl Route {
pub fn get_without_login(uri: &'static str, func: RequestProcess) -> Route {
Route {
method: GET,
need_login: false,
uri,
func
func,
}
}
@ -48,7 +46,7 @@ impl Route {
method: POST,
need_login: false,
uri,
func
func,
}
}
@ -57,7 +55,7 @@ impl Route {
method: POST,
need_login: true,
uri,
func
func,
}
}
}
@ -71,160 +69,98 @@ pub fn get_routes() -> Vec<Route> {
// Account controller
Route::post_without_login("/account/login", Box::new(account_controller::login_user)),
Route::post_without_login("/user/connectUSER", Box::new(account_controller::login_user)),
Route::post("/account/logout", Box::new(account_controller::logout_user)),
Route::post("/user/disconnectUSER", Box::new(account_controller::logout_user)),
Route::post("/account/id", Box::new(account_controller::user_id)),
Route::post("/user/getCurrentUserID", Box::new(account_controller::user_id)),
// User controller
Route::post_without_login("/user/getInfo", Box::new(user_controller::get_single)),
Route::post_without_login("/user/getInfos", Box::new(user_controller::get_single)),
Route::post_without_login("/user/getInfoMultiple", Box::new(user_controller::get_multiple)),
Route::post_without_login("/user/getInfosMultiple", Box::new(user_controller::get_multiple)),
Route::post_without_login("/user/getAdvancedUserInfo", Box::new(user_controller::get_advanced_info)),
Route::post_without_login("/user/getAdvancedUserInfos", Box::new(user_controller::get_advanced_info)),
// Friends controller
Route::post("/friends/getList", Box::new(friends_controller::get_list)),
Route::post("/friends/get_single_infos", Box::new(friends_controller::get_single_friendship_info)),
Route::post("/friends/get_user_list", Box::new(friends_controller::get_other_user_list)),
Route::post("/friends/getStatus", Box::new(friends_controller::get_status)),
Route::post("/friends/sendRequest", Box::new(friends_controller::send_request)),
Route::post("/friends/removeRequest", Box::new(friends_controller::cancel_request)),
Route::post("/friends/respondRequest", Box::new(friends_controller::respond_request)),
Route::post("/friends/remove", Box::new(friends_controller::remove_friend)),
Route::post("/friends/setFollowing", Box::new(friends_controller::set_following)),
Route::post("/friends/set_can_post_texts", Box::new(friends_controller::set_can_post_texts)),
// Conversations controller
Route::post("/conversations/create", Box::new(conversations_controller::create)),
Route::post("/conversations/getList", Box::new(conversations_controller::get_list)),
Route::post("/conversations/getInfoOne", Box::new(conversations_controller::get_single)),
Route::post("/conversations/getInfosOne", Box::new(conversations_controller::get_single)),
Route::post("/conversations/updateSettings", Box::new(conversations_controller::update_settings)),
Route::post("/conversations/getPrivate", Box::new(conversations_controller::find_private)),
Route::post("/conversations/refresh", Box::new(conversations_controller::refresh_list)),
Route::post("/conversations/refresh_single", Box::new(conversations_controller::refresh_single)),
Route::post("/conversations/get_older_messages", Box::new(conversations_controller::get_older_messages)),
Route::post("/conversations/sendMessage", Box::new(conversations_controller::send_message)),
Route::post("/conversations/get_number_unread", Box::new(conversations_controller::count_unread)),
Route::post("/conversations/get_list_unread", Box::new(conversations_controller::list_unread)),
Route::post("/conversations/delete", Box::new(conversations_controller::delete_conversation)),
Route::post("/conversations/updateMessage", Box::new(conversations_controller::update_message)),
Route::post("/conversations/deleteMessage", Box::new(conversations_controller::delete_message)),
// Search controller
Route::post("/search/user", Box::new(search_controller::search_user)),
Route::post("/user/search", Box::new(search_controller::search_user)),
Route::post("/search/global", Box::new(search_controller::search_global)),
// Groups controller
Route::post("/groups/create", Box::new(groups_controller::create)),
Route::post("/groups/get_my_list", Box::new(groups_controller::get_list_user)),
Route::post("/groups/get_info", Box::new(groups_controller::get_info_single)),
Route::post("/groups/get_multiple_info", Box::new(groups_controller::get_info_multiple)),
Route::post("/groups/get_advanced_info", Box::new(groups_controller::get_advanced_info)),
Route::post("/groups/get_settings", Box::new(groups_controller::get_settings)),
Route::post("/groups/set_settings", Box::new(groups_controller::set_settings)),
Route::post("/groups/checkVirtualDirectory", Box::new(groups_controller::check_virtual_dir)),
Route::post("/groups/upload_logo", Box::new(groups_controller::upload_logo)),
Route::post("/groups/delete_logo", Box::new(groups_controller::delete_logo)),
Route::post("/groups/get_members", Box::new(groups_controller::get_members)),
Route::post("/groups/invite", Box::new(groups_controller::invite_user)),
Route::post("/groups/cancel_invitation", Box::new(groups_controller::cancel_invitation)),
Route::post("/groups/respond_invitation", Box::new(groups_controller::respond_invitation)),
Route::post("/groups/send_request", Box::new(groups_controller::send_request)),
Route::post("/groups/cancel_request", Box::new(groups_controller::cancel_request)),
Route::post("/groups/delete_member", Box::new(groups_controller::delete_member)),
Route::post("/groups/update_membership_level", Box::new(groups_controller::update_membership)),
Route::post("/groups/respond_request", Box::new(groups_controller::respond_request)),
Route::post("/groups/get_membership", Box::new(groups_controller::get_membership)),
Route::post("/groups/remove_membership", Box::new(groups_controller::remove_membership)),
Route::post("/groups/set_following", Box::new(groups_controller::set_following)),
Route::post("/groups/delete", Box::new(groups_controller::delete_group)),
// Posts controller
Route::post("/posts/get_user", Box::new(posts_controller::get_list_user)),
Route::post("/posts/get_group", Box::new(posts_controller::get_list_group)),
Route::post("/posts/get_latest", Box::new(posts_controller::get_latest)),
Route::post("/posts/get_single", Box::new(posts_controller::get_single)),
Route::post("/posts/create", Box::new(posts_controller::create_post)),
Route::post("/posts/set_visibility_level", Box::new(posts_controller::set_visibility_level)),
Route::post("/posts/update_content", Box::new(posts_controller::update_content)),
Route::post("/posts/delete", Box::new(posts_controller::delete)),
Route::post("/posts/getAvailableTargets", Box::new(posts_controller::get_targets)),
// Comments controller
Route::post("/comments/create", Box::new(comments_controller::create)),
Route::post("/comments/get_single", Box::new(comments_controller::get_single)),
Route::post("/comments/edit", Box::new(comments_controller::edit)),
Route::post("/comments/delete", Box::new(comments_controller::delete)),
@ -234,41 +170,34 @@ pub fn get_routes() -> Vec<Route> {
// Surveys controller
Route::post("/surveys/get_info", Box::new(surveys_controller::get_info_single)),
Route::post("/surveys/send_response", Box::new(surveys_controller::send_response)),
Route::post("/surveys/cancel_response", Box::new(surveys_controller::cancel_response)),
Route::post("/surveys/create_new_choice", Box::new(surveys_controller::create_new_choice)),
Route::post("/surveys/block_new_choices_creation", Box::new(surveys_controller::block_new_choices_creation)),
// Notifications controller
Route::post("/notifications/count_unread", Box::new(notifications_controller::count_unread)),
Route::post("/notifications/count_all_news", Box::new(notifications_controller::count_all_news)),
Route::post("/notifications/get_list_unread", Box::new(notifications_controller::get_list_unread)),
Route::post("/notifications/mark_seen", Box::new(notifications_controller::mark_seen)),
Route::post("/notifications/delete_all", Box::new(notifications_controller::delete_all)),
// Movies controller
Route::post("/movies/get_list", Box::new(movies_controller::get_list)),
Route::post("/movies/delete", Box::new(movies_controller::delete)),
// Virtual directory controller
Route::post("/user/findbyfolder", Box::new(virtual_directory_controller::find_user)),
Route::post("/virtualDirectory/find", Box::new(virtual_directory_controller::find)),
// Web application controller
Route::post("/webApp/getMemberships", Box::new(web_app_controller::get_memberships)),
// Calls controller
Route::post("/calls/config", Box::new(calls_controller::get_legacy_config)),
]
}