//! # Groups controller //! //! @author Pierre Hubert use crate::api_data::res_create_group::GroupCreationResult; use crate::controllers::routes::RequestResult; use crate::data::http_request_handler::HttpRequestHandler; use crate::data::new_group::NewGroup; use crate::helpers::groups_helper; /// Create a new group pub fn create(r: &mut HttpRequestHandler) -> RequestResult { let new_group = NewGroup { name: r.post_string_opt("name", 3, true)?, owner_id: r.user_id()?, }; let group_id = groups_helper::create(&new_group)?; r.set_response(GroupCreationResult::new(&group_id)) }