diff --git a/src/controllers/mod.rs b/src/controllers/mod.rs index b2fc627..374c35d 100644 --- a/src/controllers/mod.rs +++ b/src/controllers/mod.rs @@ -20,4 +20,5 @@ pub mod web_app_controller; pub mod calls_controller; pub mod user_ws_actions; pub mod push_notifications_controller; -pub mod forez_controller; \ No newline at end of file +pub mod report_controller; +pub mod forez_controller; diff --git a/src/controllers/report_controller.rs b/src/controllers/report_controller.rs new file mode 100644 index 0000000..0be2c07 --- /dev/null +++ b/src/controllers/report_controller.rs @@ -0,0 +1,15 @@ +use crate::data::base_request_handler::BaseRequestHandler; +use crate::data::config::conf; +use crate::data::http_request_handler::HttpRequestHandler; +use crate::routes::RequestResult; + +/// Submit a new report +pub async fn report(r: &mut HttpRequestHandler) -> RequestResult { + if !conf().allow_reporting { + r.bad_request("Reporting is disabled!".to_string())?; + } + + // TODO : continue + + r.success("go on") +} \ No newline at end of file diff --git a/src/routes.rs b/src/routes.rs index 04d22c8..9adb640 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -440,6 +440,9 @@ pub async fn find_route(req_uri: &str, call: Option<&mut HttpRequestHandler>) -> // Web application controller route!(req_uri, call, POST_LOGIN, "/webApp/getMemberships", web_app_controller::get_memberships); + // Report controller + route!(req_uri, call, LTD_POST_LOGIN, "/report/create", report_controller::report, LimitPolicy::ANY(10)); + // Forez controller route!(req_uri, call, POST_LOGIN, "/forez/get_groups", forez_controller::get_list_groups); route!(req_uri, call, POST_LOGIN, "/forez/get_member_info", forez_controller::get_member_info);